[mod_python] mod_python, python_handler error "Can't get/create interpreter"

Sean Glover seanglover at sympatico.ca
Mon Apr 23 18:58:29 EDT 2007


(sorry, I accidentally sent this prematurely)

Hi Graham,

I stopped apache before I installed mod_python, but just to be sure I tried
it again.

I have several versions of python installed on my system.  I symlinked
'python' to the compiled python2.5 executable.  My /usr/local/bin directory
has the following python entries:

lrwxr-xr-x  1 root  wheel       9 Apr 20 12:38 python -> python2.5
lrwxr-xr-x  1 root  wheel      16 Mar  9 06:45 python-config ->
python2.5-config
-r-xr-xr-x  2 root  wheel    3252 Apr  9 20:32 python-shared
-r-xr-xr-x  1 root  wheel    3252 Jan 11 04:47 python-shared2.3
-r-xr-xr-x  2 root  wheel    3252 Apr  9 20:32 python-shared2.4
-r-xr-xr-x  1 root  wheel    3172 Apr  9 20:24 python-shared2.5
-r-xr-xr-x  1 root  wheel    1288 Apr  9 20:24 python-shared2.5-config
-r-xr-xr-x  1 root  wheel  771932 Jan 11 04:46 python2.3
-r-xr-xr-x  2 root  wheel  827180 Apr  9 20:32 python2.4
-r-xr-xr-x  1 root  wheel  944656 Apr  9 20:23 python2.5
-r-xr-xr-x  1 root  wheel    1281 Apr  9 20:24 python2.5-config

I tried rearranging the entries in my $PATH env var for the www user which
httpd runs under.  I stopped apache while doing this:

[www at thewire /home/wladek]$ export
PATH="/usr/local/bin:/sbin:/bin:/usr/sbin:/us
r/bin:/usr/games:/usr/local/sbin:/usr/X11R6/bin:/root/bin"
[www at thewire /home/wladek]$ echo $PATH
/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr
/X11
R6/bin:/root/bin

More lines from httpd-error.log:

[Mon Apr 23 18:52:38 2007] [warn] Init: Session Cache is not configured
[hint: SSLSessionCache]
[Mon Apr 23 18:52:39 2007] [notice] mod_python: Creating 8 session mutexes
based on 256 max processes and 0 max threads.
[Mon Apr 23 18:52:39 2007] [notice] mod_python: using mutex_directory /tmp
[Mon Apr 23 18:52:39 2007] [notice] Digest: generating secret for digest
authentication ...
[Mon Apr 23 18:52:39 2007] [notice] Digest: done
[Mon Apr 23 18:52:40 2007] [notice] Apache/2.2.0 (FreeBSD) mod_ssl/2.2.0
OpenSSL /0.9.7e-p1 DAV/2 mod_python/3.3.1 Python/2.5 PHP/5.2.0 with
Suhosin-Patch configured -- resuming normal operations
[Mon Apr 23 18:52:47 2007] [error] make_obcallback: could not call init.\n
Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/mod_python/apache.py", line
937,in init
    from mod_python import importer
  File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line
24, in <module>
    from mod_python import publisher
  File "/usr/local/lib/python2.5/site-packages/mod_python/publisher.py",
line 50, in <module>
    from cache import ModuleCache, NOT_INITIALIZED
  File "/usr/local/lib/python2.5/site-packages/mod_python/cache.py", line
27, in <module>
    import urllib2
  File "/usr/local/lib/python2.5/urllib2.py", line 88, in <module>
    import hashlib
  File "/usr/local/lib/python2.5/hashlib.py", line 104, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/usr/local/lib/python2.5/hashlib.py", line 31, in
__get_builtin_constructor
    import _md5
ImportError: No module named _md5
[Mon Apr 23 18:52:47 2007] [error] get_interpreter: no interpreter callback
found.
[Mon Apr 23 18:52:47 2007] [error] [client 76.64.190.137] python_handler:
Can't get/create interpreter.

Sean

-----Original Message-----
From: Graham Dumpleton [mailto:graham.dumpleton at gmail.com] 
Sent: Monday, April 23, 2007 6:02 PM
To: Sean Glover
Cc: mod_python at modpython.org
Subject: Re: [mod_python] mod_python, python_handler error "Can't get/create
interpreter"

On 24/04/07, Sean Glover <seanglover at sympatico.ca> wrote:
> Hello, I recently started using python 2.5 on my FreeBSD machine.  I had a
> version of mod_python up and running (sorry, I don't recall which one)
> against python 2.4.  I used the ports packages system to install
mod_python
> 3.3.1 without incident.  It replaced the old mod_python.so module and put
> the necessary python modules in my python2.5 site-packages directory.  I
> left my httpd.conf configuration the same, restarted,

When replacing mod_python version, always a good idea to do a 'stop'
and 'start' rather than a 'restart', but presuming you would have
eventually tried that.

> and hit my mod_python
> test page and receive an internal server error.  Below is a paste from my
> httpd-error.log.
>
> Could anyone suggest a solution to get mod_python (with python 2.5)
working
> with my apache 2.2 server again?

How many versions of Python do you have installed on your system?

I would probably guess you have older version of Python in /usr/bin
still and Python when being initialised within mod_python is finding
that old version, but the old version doesn't have the mod_python
Python bits.

Try setting the PATH environment variable for the user that runs
Apache to have /usr/local/bin first in the path so that it finds the
version of Python you want used before the operating system default
version.

BTW, are you sure there weren't a series of other error messages prior
to those you quoted. Can you include the dozen of so lines before that
point?

Graham

> # mod_python.so module
>
> -rwxr-xr-x  1 root  wheel  122135 Apr 23 12:43
> /usr/local/libexec/apache22/mod_python.so
>
>
>
> # mod_python python modules (/usr/local/lib/python2.5/site-packages)
>
> drwxr-xr-x   2 root  wheel    1024 Apr 23 12:43 mod_python
>
> -rw-r--r--   1 root  wheel     254 Apr 23 12:43
> mod_python-3.3.1-py2.5.egg-info
>
>
>
> # apache httpd.conf file entry
>
> LoadModule python_module libexec/apache22/mod_python.so
>
>
>
> # test .htaccess
> (http://randonom.com/test/python/mptest.py)
>
> AddHandler mod_python .py
>
> PythonHandler mptest
>
> PythonDebug On
>
>
>
> # httpd-error.log after hitting the URL above ^
>
> [Mon Apr 23 13:37:40 2007] [error] get_interpreter: no interpreter
callback
> found.
>
> [Mon Apr 23 13:37:40 2007] [error] [client 65.36.178.226] python_handler:
> Can't get/create interpreter.
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
 




More information about the Mod_python mailing list