Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

For Python 3.2, use source code from the mod_wsgi repository.

http://code.google.com/p/modwsgi/source/checkout

share|improve this answer
    
Thank you. I checked out the current version and it compiled and installed using the same instructions as I posted in the answer. However when I go to request a page, apache hangs. I turned off modwsgi and there is no problem so I think it's with the most recent version. I've updated my question (at the bottom) with the tail of the apache log file. –  aaronasterling Mar 21 '12 at 23:24
    
Sorry, there was a misconfiguration on my part. I've fixed it and the problem's solved. Thanks again. –  aaronasterling Mar 21 '12 at 23:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.