[mod_python] troubles with installing

Graham Dumpleton grahamd at dscpl.com.au
Sun Feb 26 16:36:35 EST 2006

See comments below.

John Raines wrote ..
> It had been a year since I'd installed mod_python and I seem to be  
> having a huge problem getting the new version to work here on my Mac  
> running  10.4.5.
> I set out to upgrade to httpd-2.0.55 and 3.2.7 (now 3.2.8) a couple  
> of weeks ago!
> Apache seems to serve a plain HTML page OK. But when I move to call  
> mod_python I get an error and that is reflected in the log below. If  
> I start python outside of Apache and import mod_python.psp it finds  
> psp but can't find _apache.
> Here's what Apache's startup log says; if I were just a little  
> smarter I'd probably know just what to do:
> [Sun Feb 26 09:03:50 2006] [notice] mod_python: Creating 8 session  
> mutexes based on 150 max processes and 0 max threads.
> [Sun Feb 26 09:03:50 2006] [notice] Apache configured -- resuming  
> normal operations
> [Sun Feb 26 09:04:38 2006] [error] make_obcallback: could not import  
> mod_python.apache.\n
> Could not find platform independent libraries <prefix>
> Could not find platform dependent libraries <exec_prefix>
> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
> 'import site' failed; use -v for traceback
> 'import site' failed; use -v for traceback
> ImportError: No module named mod_python.apache
> [Sun Feb 26 09:04:38 2006] [error] python_handler: no interpreter  
> callback found.
> [Sun Feb 26 09:04:38 2006] [error] [client] python_handler: 
> Can't get/create interpreter., referer:
> 'import site' failed; use -v for traceback
> ImportError: No module named mod_python.apache
> Do I need to use terminal to set $PYTHONHOME to /usr/bin/python2.3 or 
> is this something I'd do in httpd.conf?
> I tried doing it in terminal without any luck.
> Here is the sequence of commands I used for installing :
> sudo apachectl stop
> cd ~/Desktop/httpd-2.0.55
> ./configure --enable-so --with-mpm=prefork

You should be able to say just:


The "prefork" MPM is the default on Mac OS X. Also no specific need to enable
shared objects for builtin modules.

> make
> sudo make install
> cd ~/Desktop/mod_python-3.2.8
> ./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/ 
> usr/bin/python2.3

Don't specify path to Python binary, let it find it itself, unless you have
more than one Python installation. If you do have more than one Python
installation, either make sure that /usr/bin is first in your PATH, or if
you still must specify the Python binary location, don't include the "2.3"
designation as suspect that that is what is stuffing it up. Ie.,

  /configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/python

> make
> sudo make install
> sudo cp ~/Desktop/httpd.conf /usr/local/apache2/conf
> sudo cp /usr/local/apache2/bin/apachectl /usr/sbin
> sudo apachectl start
> As you'd expect from the results running python outside apache, the  
> site-packages directory deep in the Framework directory has the  
> mod_python package and the modules directory in apache2 has the .so  
> file. At one time (when running Panther), I did have multiple pythons 
> installed on the hard drive where I've been trying to debug this  
> procedure. I trashed them and installed Tiger early on in my efforts.

More information about the Mod_python mailing list