Hi all,

I have severe problems to get my Apache 2 to run mod_python together
with Python 2.5 on Mac OS X 10.4.10.

This is my sad story:

I'm developing a small in-house publication database for bibliometric
purposes. I run a Ubuntu Linux-based server with Apache, Python and
PostgreSQL, but I have my development environment on my MacBook Pro,
running Mac OS X 10.4.10.

I recently installed a new Linux server with Ubuntu 7.04 and the
installation of all Django-needed software went really smooth with apt-
get. I now have Apache 2.1, Python 2.5 and PostgreSQL 8.2 running on
the server, together with Django and mod_python and psycopg2.

When I did some adjustments to my develop environment on my Mac, I
suddenly realized that I was running Python 2.5 (installed from a DMG)
as my local script environment, but the Apache server was still
running its mod_python through MacPorts Python 2.4. It was when I
decided to fix this to get my develop environment at par with my
server environment hell broke loose.

Naively, I first ran a MacPorts "sudo port install mod_python25". The
installation detected a dependency on MacPorts Python 2.5 and
installed it (fair enough), but didn't update my $PATH, so the
following installation of mod_python25 failed, complaining about a
missing "math" module. After some tweaking of paths in my .profile, I
got the mod_python25 through the installation, but Apache wouldn't run
mod_python, claiming that it still was built for Python 2.4 in its
error log, and also looking for mod_python in the wrong site-packages
directory.

To make things even worse, I stupidly tried to install psycopg2 for
running together with Python 2.5, calling command "sudo port install
py-psycopg2". This installation process started by installing MacPorts
Python 2.4 (!) and then PostgreSQL 8.1, although I already had
MacPorts PostgreSQL 8.2 running on the system. The installation
process once again didn't update my $PATH and thus failed, complaining
about a missing "math" module. I once again tweaked my path and got
psycopg2 through the installation, but the resulting package ended up
in the wrong site-packages directory.

So, now I had a situation with both MacPorts Python 2.4 and 2.5
installed, together with DMG-installed Python 2.4 and Python 2.5 and a
total confusion regarding what paths to use. I tried to read the
documentation, but couldn't really sort out what to put in my $PATH,
$PYTHONHOME and my $PYTHONPATH.

I decided to start over and go the full MacPorts way, so I cleared out
all versions of Python, together with mod_apache and psycopg2 and
tried a clean MacPorts install. The result was about the same as
before, with Python parts ending up in funny places, broken paths and
the mod_python25 installation complaining about the version problem.

Since the MacPorts way didn't work, I decided to go the other way and
installed the DMG version of Python 2.5, downloaded packages for
mod_python and psycopg2 and compiled them manually. The result was the
same as before, mod_python claiming that it was compiled for running
together with Python 2.4 and refusing to run together with Python 2.5.

After about a week of frustrating struggle, I decided to give up and
try to put the system back in the state it was before all this
started, with Apache running mod_python through Python 2.4. I once
again cleared out all versions of Python, tried to locate all
configuration files and remove all traces of Python 2.5 and rebooted
the system. Then I did an install of the DMG version of Python 2.4 and
got it working in the proper place.

After that I compiled the mod_python, pointing at the newly installed
Python 2.4 and got it through compilation, but the compiled package
ended up in this location:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.5/site-
packages/

(Notice the python2.5 in the Versions/2.4 path?! It wasn't there
before, but was actually created by the mod_python installation.)

This didn't work, since Apache and Python 2.4 was looking for
mod_python in the
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/
directory. After moving the mod_python module there, things finally
started to work.

Then I compiled the psycopg2 and it also installed itself in:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.5/site-
packages/
and had to be manually moved to:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/
to get it to start to work.

So, to end this long and sad story, I want to pose some questions:

1. Is there any hidden setting in Mac OS X that the installation
procedures read to generate this funny path? I don't have it in
my .profile (and I don't have a .bashrc) and I tried to grep the whole
system for "python2.5" and checked both my env and sudo env and I
can't find it.

2. How should the variables $PATH, $PYTHONHOME and $PYTHONPATH be set
in a properly installed Python on a Mac OS system?

3. Which is the best way to go to install a Django environment on Mac
OS X? I would prefer to use MacPorts, because that makes my Mac
resemble my Linux server environment the most, but as it looks as if
MacPorts is lagging behind, maybe this is not the right way to go for
the latest versions? Would a DMG-based installation of Python 2.5 and
compilation of mod_python and psycopg by hand be a better alternative,
once I get this stuff with the "hidden path setting" sorted out?

To sum up: Has anyone the combination Python 2.5, Apache 2.1,
PostgreSQL 8.2, mod_python, and psycopg2 running on Mac OS, and how
did you get there?

Sorry for this long problem-stuffed posting, but if I get this solved
maybe I can get back with a summary to make lives easier for some Mac-
based Django developers.

Kind regards,
Ulf


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to