Installing Mod-wsgi 3.3 for apache 2.2 and python 3.2

Posted by aaronasterling on Server Fault See other posts from Server Fault or by aaronasterling
Published on 2012-03-21T05:38:31Z Indexed on 2012/03/21 23:31 UTC
Read the original article Hit count: 341

Filed under:

I am attempting to install Mod-wsgi 3.3 on an ubuntu 11.10 desktop edition with apache 2.2 and python 3.2

I downloaded the source tarball and extracted it. I configured it using the --with-python=/usr/bin/python3 option to configure. This is the only copy of python3 that I have installed.

I then issued the commands make and sudo make install.

I attempted to restart apache using sudo /etc/init.d/apache2 restart and get the following error message:

apache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Syntax error on line 1
of /etc/apache2/mods-enabled/wsgi.load: Cannot load /usr/lib/apache2/modules
/mod_wsgi.so into server: /usr/lib/apache2/modules/mod_wsgi.so: undefined symbol: 
PyCObject_FromVoidPtr
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!

The error logs only inform us that it's a segfault: `

I checked to make sure that it's linked against the right python library with ldd mod_wsgi.so and got the output

linux-gate.so.1 =>  (0x00d66000)
libpython3.2mu.so.1.0 => /usr/lib/libpython3.2mu.so.1.0 (0x0065b000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00a20000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00110000)
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0x0028c000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0x0044c000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0x002d9000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0x00eb3000)
libexpat.so.1 => /lib/i386-linux-gnu/libexpat.so.1 (0x00abe000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x002e0000)
libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0x00c47000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x00e24000)
/lib/ld-linux.so.2 (0x0042c000)

It seems to be linking against the python3 library so I'm not sure what the issue is. I have read on another question that mod-python can present problems however it was never installed.

I saw that the directive WSGIPythonHome can be used to point to the correct python version and created a directory /usr/bin/apache2-python/ with a link named python and python3(the name I passed to the configure script) to /usr/bin/python3 This results in the same error. So I'm pretty sure it's using the correct version of python.

I am now at a loss.

Thanks in advance for any help.

update

Using the version from the repository I get the following log when I attempt to request a page:

[Wed Mar 21 13:21:11 2012] [notice] child pid 5567 exit signal Aborted (6)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding
[Wed Mar 21 13:21:13 2012] [notice] child pid 5568 exit signal Aborted (6)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding
[Wed Mar 21 13:21:14 2012] [notice] caught SIGTERM, shutting down

If I comment out the instruction to load mod-wsgi, the page serves normally.

© Server Fault or respective owner

Related posts about apache2