[mod_python] problems installing on OS 10.5

Graham Dumpleton graham.dumpleton at gmail.com
Sun Mar 8 22:34:46 EDT 2009

2009/3/9 Dan Yamins <dyamins at gmail.com>:
> Hi, I'm having problems building mod_python on Mac OS10.5.
> Here's how the problem arose:
> 1) I got source for the 3.3.1 release.  I built the source following the
> directions on the website
> (http://www.modpython.org/live/current/doc-html/inst-compiling.html).    The
> build seemed to have gone fine.
> 2) Then, I tried to configure apache.   At the end of the make install
> process, it told me to add the following line to  my httpd.conf file:
>    LoadModule python_module        libexec/apache2/mod_python.so
> I did this, and then restarted apache.
> 3) At this point, I began to get the message "Firefox can't establish
> connection to server..." for all the servers served by apache on my machine.
> 4) So, I ran the command apachectl -t .   This produced the following
> output:
> "syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot load
> /usr/libexec/apache2/mod_python.so into server:
> dlopen(/usr/libexec/apache2/mod_python.so, 10): no suitable image found.
> Did find:\n\t/usr/libexec/apache2/mod_python.so: no matching architecture in
> universal wrapper"
> 5) So I looked up this error on google.  Apparently this is a known problem
> (see e.g.
> http://mail-archives.apache.org/mod_mbox/quetz-mod_python-dev/200807.mbox/%3C569803375.1216130972521.JavaMail.jira@brutus%3E).
> It was suggested that the the problem is that "the compiler is not creating
> a full fat version of the Apache module for mod_wsgi and when it is loaded
> into Apache, it can't find correct version for the architecture."
> I followed these instructions here:
> http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX
> (-- albeit they're for wsgi, but shold be similar for mod_python).
> After modifying the Makefile and redoing make && sudo make install, it still
> does not work.  I still get the same error from apachectl, and
> running "file /usr/libexec/apache2/mod_python.so"  shows that I still don't
> have 64bit binaries:
> "/usr/libexec/apache2/mod_python.so: Mach-O universal binary with 2
> architectures
> /usr/libexec/apache2/mod_python.so (for architecture i386):    Mach-O bundle
> i386
> /usr/libexec/apache2/mod_python.so (for architecture ppc):    Mach-O bundle
> ppc"
> 6) So, what do I do?

Use source code for mod_python from mod_python subversion repository
as that version includes all MacOS X Leopard fixes.

Even better, if you are only wanting to host an application that
support WSGI interface and not using mod_python specific APIs, use
mod_wsgi instead. Pretty well all Python web applications and
frameworks support WSGI interface these days and mod_wsgi is arguably
a better solution these days.


More information about the Mod_python mailing list