[mod_python] mod_python.so: undefined symbol: ap_loaded_modules

Mark Dokter dokter at icg.tu-graz.ac.at
Wed Nov 16 10:20:29 EST 2005

On Wednesday 16 November 2005 05:25, Graham Dumpleton wrote:

> A random bit of information that may not be relevant, but if you have
> multiple versions of Python installed and the one which is first in your
> PATH is not the same one as mod_python was built for, and you run
> "apachectl restart" or "apachectl start" explicitly, mod_python can fail
> because it will use the one found in PATH and not the one it was built
> for.

I followed the FAQ to check the mod_python version:
Set sys.path to 
>>> sys.path
['/usr/lib/python2.3/site-packages', '/usr/lib/python2.3', ...]

When importing mod_python.psp this gabe me:
>>> import mod_python.psp
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/mod_python/psp.py", line 20, in ?
    import apache, Session, util, _psp
  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 28, in ?
    import _apache
ImportError: No module named _apache

According to the FAQ this should be version 3.1 (as apt already told me)

I set the PythonPath variable in /etc/apache2/mods-enabled/mod_python.conf 
like this:

PythonPath "['/usr/lib/python2.3','/usr/lib/python2.3/site-packages',

But I still get this in the log file:
[Wed Nov 16 16:06:42 2005] [error] make_obcallback: could not import 

> The reason for failure can be because the one found doesn't have the
> mod_python Python code components installed for it, or it has a
> different version mod_python Python code components which are
> incompatible.

I have the same package versions installed on another Debian system where it 
works. So there must be something wrong with the configuration. The faulty 
system was set up by someone else a while ago. There is 
a /usr/lib/python2.2, /usr/lib/python2.4 and a /usr/local/python2.3. But 
according to my PATH settings only /usr/lib/python2.3 is used. mod_python is 
installed in /usr/lib/python2.3/site-packages/mod_python.

> You may get a better indication of what the problem is if you were using
> mod_python 3.2 (BETA) as older versions didn't always write out or flush
> out error messages properly which gave an indication of the true reason
> for the error. You may also only find error messages in the Apache log
> file appearing when you later shut Apache down. Ie., they don't end up
> in the log at time of startup when the problem occurs, but when buffers
> flushed on shutdown.

3.2 is not available in the testing and unstable tree and I don't want to 
create a deb for it (never done that before - I actually prefer Gentoo, but 
here at work I have to use Debian).
I'll consider this as the last option.

> Graham

thx for suggestions,


More information about the Mod_python mailing list