[mod_python] could not import mod_python.apache

Graham Dumpleton grahamd at dscpl.com.au
Fri Mar 4 01:19:11 EST 2005


bruce wrote ..
> hi...
> 
> i'm trying to implement 'trac' (trac.edgewall.com) and seem to be running
> into an issue.
> 
> i'm having an issue where i'm geting a 'could not import mod_python.apache'
> error in my apache error log file.
> 
> i'm running linux rh8.0, apache2.50, mod_python3.1.3-5
> 
> searching google/etc doesn't give any light on this...
> 
> any ideas as to what's going on here?
> 
> if needed, i could supply the relevant segment of the apache config file.

Config file information can always be useful, but in this case possibly
not unless it contains a PythonPath setting which totally overrides the
standard Python search path, which would be wrong.

Anyway, the basic problem here seems to be that the mod_python module
cannot find "mod_python.apache" which is normally installed into the
Python site-packages directory for the version of Python being used.

Possibilities are that it isn't installed, or that it is installed into a different
version of Python than what Apache is using. How many versions of
Apache do you have on your box?

If mod_python has been installed, you can determine some stuff about
it by executing "python" itself and attempting to import the module
"mod_python.psp". For example:

  ~ [510]$ python
  Python 2.3 (#1, Sep 13 2003, 00:49:11) 
  [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import mod_python.psp

If you see a Python exception of the form:

  ImportError: No module named _apache

it means that you have mod_python version 3.1. If you see the Python exception:

  ImportError: No module named psp

it means that you only have version 2.7. Finally, if you instead see the Python exception:

  ImportError: No module named mod_python.psp

it means that mod_python isn't installed after all, or at least not for the version of
Python you are trying to use.

Graham


More information about the Mod_python mailing list