Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-31 Thread girzel

Whoops, sorry, ignore that last...

On Nov 1, 10:16 am, [EMAIL PROTECTED] wrote:
> Ulf, did you ever figure this out? I don't use pgsql/psycopg, but I've
> had the same issues with mod_python and competing framework/MacPort
> installations of Python. And I didn't even know there was a
> $PYTHONHOME variable.
>
> I've done everything I can to change paths and reroute framework-
> Python to Macport-Python using symbolic links, but still mod_python
> tracebacks show that, at some point during the trace, it is trying to
> get at the framework installation of Python.
>
> Bumping hopefully...
>
> E


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-22 Thread Ulf Kronman

> That one has to go to the
> extent of reading the Python source code to fully understand what it
> is for is a good sign that the typical user shouldn't be using it for
> anything. If it is there for any reason, I'd say it is more for people
> who are tinkering with the actual Python code itself.

OK, that's way beyond my level of competence, so have now deleted the
PYTHONHOME from my .profile and will never use it again.

I'll will also consider switching to mod_wsgi in the future.

// 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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Graham Dumpleton

On Oct 22, 3:01 pm, Ulf Kronman <[EMAIL PROTECTED]> wrote:
> Hi Graham,
>
> > You should not need to set PYTHONHOME and doing so could cause a lot
> > of problems because if you now run /usr/bin/python2.3 directly or
> > indirectly, it will pick up the wrong installed version of Python
> > modules.
>
> OK, I'll remove it. But why should I want to run Python 2.3?

You might not, but some third party package or even some script
supplied as part of the operating system might want to run Python as /
usr/bin/python explicitly. In this case it will bypass your PATH
variable but still might feasibly inherit your PYTHONHOME variable,
thereby causing the script to fail because it will be using modules
from wrong version of Python.

> As I have
> both
> /Library/Frameworks/Python.framework/Versions/Current/bin and /usr/
> local/bin/ before /usr/bin in my $PATH any python call would pick up
> my new 2.5 version.
>
> > I wouldn't be surprised that a lot of your problems with stuff being
> > installed into wrong place before was because you were setting
> > PYTHONHOME to one version and then running different version of
> > Python.
>
> But I was careful to change that setting in .profile and restart the
> terminal session each time I did a try on a new version.
>
> > In short, do not set PYTHONHOME.
>
> So, why is it there, then? Do you know where I can find any good
> documentation on it?

There isn't any really good documentation on it and other internal
environment variables that I know of. Running 'python -h' or looking
at comments in Modules/getpath.c source code may be the best you get
for PYTHONHOME and some of the other stuff. To partly understand how
it fits into the Python startup sequence you need to understand the
internals of how Python finds its library directory when it starts up.
The comments in Modules/getpath.c can help with some of that,
otherwise need to look at code itself. That one has to go to the
extent of reading the Python source code to fully understand what it
is for is a good sign that the typical user shouldn't be using it for
anything. If it is there for any reason, I'd say it is more for people
who are tinkering with the actual Python code itself.

Only good reason I have seen for fiddling with it is when using
something like mod_python embedded in Apache where you have multiple
versions of Python installed and you can't fiddle the order of PATH
inherited by Apache and so need to set PYTHONHOME in envvars instead.
This is a quite constrained use case and can still cause the same
problems I am warning you about for anything programs executed from
any Apache web applications. In mod_wsgi there is an explicit
directive WSGIPythonHome that can be used to achieve the same affect,
but without setting an environment variable and therefore interfering
with sub process scripts. In this case mod_wsgi is actually calling
internal Py_SetPythonHome() function before actually initialising
Python.

Graham

> > Also, what documentation did you read that said to set PYTHONHOME in
> > the first place. There are only exceptional conditions where you would
> > want to do this and then only when you fully understand what setting
> > it does.
>
> When I had problems with the different versions and paths of python,
> starting the interpreter gave me an error message that it couldn't
> load its modules, and suggested me to set the PYTHONHOME ("consider
> setting PYTHONHOME"), and so I did, and that fixed the problem at that
> time. Now I don't have this problem anymore, so it works fine without
> PYTHONHOME.
>
> // 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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Ulf Kronman

Hi Graham,

> You should not need to set PYTHONHOME and doing so could cause a lot
> of problems because if you now run /usr/bin/python2.3 directly or
> indirectly, it will pick up the wrong installed version of Python
> modules.

OK, I'll remove it. But why should I want to run Python 2.3? As I have
both
/Library/Frameworks/Python.framework/Versions/Current/bin and /usr/
local/bin/ before /usr/bin in my $PATH any python call would pick up
my new 2.5 version.

> I wouldn't be surprised that a lot of your problems with stuff being
> installed into wrong place before was because you were setting
> PYTHONHOME to one version and then running different version of
> Python.

But I was careful to change that setting in .profile and restart the
terminal session each time I did a try on a new version.

> In short, do not set PYTHONHOME.

So, why is it there, then? Do you know where I can find any good
documentation on it?

> Also, what documentation did you read that said to set PYTHONHOME in
> the first place. There are only exceptional conditions where you would
> want to do this and then only when you fully understand what setting
> it does.

When I had problems with the different versions and paths of python,
starting the interpreter gave me an error message that it couldn't
load its modules, and suggested me to set the PYTHONHOME ("consider
setting PYTHONHOME"), and so I did, and that fixed the problem at that
time. Now I don't have this problem anymore, so it works fine without
PYTHONHOME.

// 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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Graham Dumpleton

On Oct 22, 5:36 am, Ulf Kronman <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> > Have you made any try on Python 2.5 together with mod_python?
>
> I'll reply to myself here, since I finally got mod_python to work with
> Python 2.5!
>
> Here's how I did it:
> --
>
> Installed Python 2.5.1 from the DMG package.
>
> Set up paths in my ~/.profile:
> export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
> ${PATH}"
> export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/2.5/

You should not need to set PYTHONHOME and doing so could cause a lot
of problems because if you now run /usr/bin/python2.3 directly or
indirectly, it will pick up the wrong installed version of Python
modules.

I wouldn't be surprised that a lot of your problems with stuff being
installed into wrong place before was because you were setting
PYTHONHOME to one version and then running different version of
Python.

In short, do not set PYTHONHOME.

Also, what documentation did you read that said to set PYTHONHOME in
the first place. There are only exceptional conditions where you would
want to do this and then only when you fully understand what setting
it does.

Graham

> Downloaded mod_python 3.3.1 
> from:http://httpd.apache.org/modules/python-download.cgi
>
> Ran
> $ sudo ./configure --with-apxs=/opt/local/apache2/bin/apxs --with-
> python=/Library/Frameworks/Python.framework/Versions/2.5/bin/python
> $ sudo make
> $ sudo make install
>
> This installed a new mod_python in:
> /opt/local/apache2/modules/mod_python.so
>
> And it installed mod_python packages in the right python directory
> this time:
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
> packages/mod_python/
>
> Enabled mod_python in /opt/local/apache2/conf/httpd.conf (I had that
> done before, for the python 2.4 version):
> LoadModule python_module modules/mod_python.so
>
> Restarted Apache:
> sudo /opt/local/apache2/bin/apachectl -k restart
>
> And saw this notice in the Apache error_log:
> [notice] Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8e DAV/2
> mod_python/3.3.1 Python/2.5.1 configured -- resuming normal operations
>
> --
>
> Phew! My two-week nightmare seems to be over and I can resume to
> normal operations, running the same versions of Django parts on my
> MacBook as on the Ubuntu server: Python 2.5.1, Apache 2.2.6,
> PostgreSQL 8.2, mod_python 3.3.1, psycopg2-2.0.5.1, docutils-0.5,
> together with our favorite web application framework, Django of
> course!
>
> Thanks for your kind support,
> 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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Ulf Kronman

Hi all,

> Have you made any try on Python 2.5 together with mod_python?

I'll reply to myself here, since I finally got mod_python to work with
Python 2.5!

Here's how I did it:
--

Installed Python 2.5.1 from the DMG package.

Set up paths in my ~/.profile:
export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
${PATH}"
export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/2.5/

Downloaded mod_python 3.3.1 from: 
http://httpd.apache.org/modules/python-download.cgi

Ran
$ sudo ./configure --with-apxs=/opt/local/apache2/bin/apxs --with-
python=/Library/Frameworks/Python.framework/Versions/2.5/bin/python
$ sudo make
$ sudo make install

This installed a new mod_python in:
/opt/local/apache2/modules/mod_python.so

And it installed mod_python packages in the right python directory
this time:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/mod_python/

Enabled mod_python in /opt/local/apache2/conf/httpd.conf (I had that
done before, for the python 2.4 version):
LoadModule python_module modules/mod_python.so

Restarted Apache:
sudo /opt/local/apache2/bin/apachectl -k restart

And saw this notice in the Apache error_log:
[notice] Apache/2.2.6 (Unix) mod_ssl/2.2.6 OpenSSL/0.9.8e DAV/2
mod_python/3.3.1 Python/2.5.1 configured -- resuming normal operations

--

Phew! My two-week nightmare seems to be over and I can resume to
normal operations, running the same versions of Django parts on my
MacBook as on the Ubuntu server: Python 2.5.1, Apache 2.2.6,
PostgreSQL 8.2, mod_python 3.3.1, psycopg2-2.0.5.1, docutils-0.5,
together with our favorite web application framework, Django of
course!

Thanks for your kind support,
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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Ulf Kronman


Hi Leo,

> Both in that effort and in some previous attempts to configure my
> Python, I ended up avoiding MacPorts entirely.  It's a good concept
> but just wasn't standard enough or up-to-date enough.  Also, I try to
> stick to Framework installs of Python whereever they come from...

OK, it seems as if you have come to the same conclusion as I - that
it's safest to install the Python DMG versions and compile packages by
hand. It's a pity, since MacPorts is very convenient, when it works.

Have you made any try on Python 2.5 together with mod_python?

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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-21 Thread Ulf Kronman

Hi again Graham,

> No, that is a different flag. It is -Wl,-f not -Wl,-F. They mean
> different things. You would use:
>
>   LDFLAGS = -Wl,-F/Library/Frameworks .existing options

OK, I understand. The -F option is just to point to the right
framework location.
But my previous compilation/installation found the right framework
path, using the -framework,Python option, since I'm using the DMG
version of Python 2.4, installed in the proper location. It was just
the ending of the path that was faulty with:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.5/site-
packages/
instead of:
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-
packages/

But I can give the -F option a try to see if it makes things better.

> > Aha. So would that be like an ordinary $PATH setting in my
> > bash .profile?:
> > export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
> > ${PATH}"
>
> Yes, but in the envvars file.

OK, thanks, I'll remember that.

> Note that this is only required because you have a secondary version
> of Python installed in a non standard location. I believe if you use
> dmg versions and not MacPorts it installs in standard locations and so
> this isn't required.

OK, but I actually run the DMG version of Python 2.4, installed in the
proper location in /Library/Framworks/Python.framework/ ...
and Apache finds the mod_python in site-packages, once I have moved
the compiled package from the python2.5/site-packages where the
installation puts it to the python2.4/site-packages where Apache
expects it to be.

> Half the problem here is mod_python and the fact that it has two
> parts, the Apache module and the Python modules. If the Apache module
> cant find the Python modules at runtime it will not work. You might
> instead consider looking at mod_wsgi instead. It is totally self
> contained in the Apache module and doesn't need the separate Python
> modules and therefore you cant get this specific problem. You still
> have to deal with the problems related to multiple Python versions,
> but this is explained in the documentation for mod_wsgi.

This seems to be a better solution for the future, I'll consider this.

Thanks,
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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-20 Thread Leo

I had a the same symptom when getting Mac OS X 10.4 (comes with Python
2.3) + Python 2.4.3 + mod_python 3.3.1 + apache 2.2.6 going (and in
fact, got help from Graham).  I ended up having to explicitly point to
the right Python framework in my LD_FLAGS line:

LDFLAGS= -Wl,-F/Library/Frameworks  -u _PyMac_Error /Library/
Frameworks/Python.framework/Versions/2.4/Python   -arch ppc -arch i386
-isysroot /Developer/SDKs/MacOSX10.4u.sdk -g

and then mod_python finally functioned.

Both in that effort and in some previous attempts to configure my
Python, I ended up avoiding MacPorts entirely.  It's a good concept
but just wasn't standard enough or up-to-date enough.  Also, I try to
stick to Framework installs of Python whereever they come from...

Good luck!

Leo


On Oct 20, 10:39 pm, Ulf Kronman <[EMAIL PROTECTED]> wrote:
> Hi Graham,
> thanks for your answer. Here some replies to your comments.
>
> > A few quick comments, although you may have so mucked up your
> > installations you might be better reinstalling everything, include the
> > OS from scratch. :-)
>
> Uh-uh. So this implies that there may be some settings tucked away in
> some place where I can't get to? But it seems as if both installation
> scripts for mod_python and psycopg2 can find and read this faulty
> setting, since they both put their packages in the funny python2.5/
> site-packages/ beneath my python2.4 path.
>
> > 1. Why are you using Apache 2.1. The Apache 2.1 stream was a
> > developmental version stream, it should not be used for production
> > use. You should use either Apache 2.0.X or Apac 2.2.X streams.
>
> Sorry for giving you the wrong Apache version. I checked with MacPorts
> and I am in fact running Apache 2.2.6 and it was this version I
> pointed at while compiling the mod_python.
>
> > 2. When building mod_python, you should use --with-python option to
> > indicate an alternate version of Python to use.
>
> Yes, I did point at my Python 2.4. Here is the config command I used:
> ./configure --with-apxs=/opt/local/apache2/bin/apxs --with-python=/
> Library/Frameworks/Python.framework/Versions/2.4/bin/python
>
> When I did my trials with Python 2.5, I also pointed at that version
> in the compilation, but still got a mod_python that said it was
> compiled for running Python 2.4 as a result.
>
> > 3. Often with MacPorts versions of Python, when building mod_python
> > you must manually edit the src/Makefile to insert additional linker
> > option into LDFLAGS to indicate where the Python framework libraries
> > are for the version of Python being used. For example, something like:
>
> >   LDFLAGS = -Wl,-F/opt/local/Library/Frameworks 
>
> OK, thanks. I saw a note about that somewhere, and I used it while
> trying with Python 2.5. I'll have a check if this points the wrong way
> for my Python 2.4 compilation. Right now it looks like this:
> LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/
> Versions/$(VERSION)/$(PYTHONFRAMEWORK) ...
>
> Do you think I should replace the -Wl,-framework,Python part with:
> -Wl,-F/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> site-
> packages/   ?
>
> > 4. When running Apache with that mod_python version, the PATH of the
> > user that Apache runs as must find first the version of the 'python'
> > executable you specified to the --with-python option before any other
> > versions of Python. This can be done by setting the PATH environment
> > variable appropriately in the 'envvars' file in the same directory as
> > the Apache httpd program executable.
>
> Aha. So would that be like an ordinary $PATH setting in my
> bash .profile?:
> export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
> ${PATH}"
>
> The thing is that I right now have a working environment, but I feel a
> bit nervous about the fact that packages install in the wrong
> directory out of my control.
>
> Sooner or later, I also have to go up to Python 2.5 for my scripting,
> since I need that version for some unicode-related hacks, due to the
> lack of unicode handling in the CSV package I use for loading my data.
> Before this havoc, I was running python 2.5 for my scripts and python
> 2.4 for the web server (without knowing it). When I install python
> 2.5, do you think I should use the MacPorts version or the DMG
> version?
>
> Thanks for your help,
> 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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-20 Thread Graham Dumpleton


Ulf Kronman wrote:
> Hi Graham,
> thanks for your answer. Here some replies to your comments.
>
> > A few quick comments, although you may have so mucked up your
> > installations you might be better reinstalling everything, include the
> > OS from scratch. :-)
>
> Uh-uh. So this implies that there may be some settings tucked away in
> some place where I can't get to? But it seems as if both installation
> scripts for mod_python and psycopg2 can find and read this faulty
> setting, since they both put their packages in the funny python2.5/
> site-packages/ beneath my python2.4 path.
>
> > 1. Why are you using Apache 2.1. The Apache 2.1 stream was a
> > developmental version stream, it should not be used for production
> > use. You should use either Apache 2.0.X or Apac 2.2.X streams.
>
> Sorry for giving you the wrong Apache version. I checked with MacPorts
> and I am in fact running Apache 2.2.6 and it was this version I
> pointed at while compiling the mod_python.
>
> > 2. When building mod_python, you should use --with-python option to
> > indicate an alternate version of Python to use.
>
> Yes, I did point at my Python 2.4. Here is the config command I used:
> ./configure --with-apxs=/opt/local/apache2/bin/apxs --with-python=/
> Library/Frameworks/Python.framework/Versions/2.4/bin/python
>
> When I did my trials with Python 2.5, I also pointed at that version
> in the compilation, but still got a mod_python that said it was
> compiled for running Python 2.4 as a result.
>
> > 3. Often with MacPorts versions of Python, when building mod_python
> > you must manually edit the src/Makefile to insert additional linker
> > option into LDFLAGS to indicate where the Python framework libraries
> > are for the version of Python being used. For example, something like:
> >
> >   LDFLAGS = -Wl,-F/opt/local/Library/Frameworks 
>
> OK, thanks. I saw a note about that somewhere, and I used it while
> trying with Python 2.5. I'll have a check if this points the wrong way
> for my Python 2.4 compilation. Right now it looks like this:
> LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/
> Versions/$(VERSION)/$(PYTHONFRAMEWORK) ...
>
> Do you think I should replace the -Wl,-framework,Python part with:
> -Wl,-F/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
> site-
> packages/   ?

No, that is a different flag. It is -Wl,-f not -Wl,-F. They mean
different things. You would use:

  LDFLAGS = -Wl,-F/Library/Frameworks .existing options

> > 4. When running Apache with that mod_python version, the PATH of the
> > user that Apache runs as must find first the version of the 'python'
> > executable you specified to the --with-python option before any other
> > versions of Python. This can be done by setting the PATH environment
> > variable appropriately in the 'envvars' file in the same directory as
> > the Apache httpd program executable.
>
> Aha. So would that be like an ordinary $PATH setting in my
> bash .profile?:
> export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
> ${PATH}"

Yes, but in the envvars file.

Note that this is only required because you have a secondary version
of Python installed in a non standard location. I believe if you use
dmg versions and not MacPorts it installs in standard locations and so
this isn't required.

> The thing is that I right now have a working environment, but I feel a
> bit nervous about the fact that packages install in the wrong
> directory out of my control.
>
> Sooner or later, I also have to go up to Python 2.5 for my scripting,
> since I need that version for some unicode-related hacks, due to the
> lack of unicode handling in the CSV package I use for loading my data.
> Before this havoc, I was running python 2.5 for my scripts and python
> 2.4 for the web server (without knowing it). When I install python
> 2.5, do you think I should use the MacPorts version or the DMG
> version?

Half the problem here is mod_python and the fact that it has two
parts, the Apache module and the Python modules. If the Apache module
cant find the Python modules at runtime it will not work. You might
instead consider looking at mod_wsgi instead. It is totally self
contained in the Apache module and doesn't need the separate Python
modules and therefore you cant get this specific problem. You still
have to deal with the problems related to multiple Python versions,
but this is explained in the documentation for mod_wsgi.

Graham


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-20 Thread Ulf Kronman

Hi Graham,
thanks for your answer. Here some replies to your comments.

> A few quick comments, although you may have so mucked up your
> installations you might be better reinstalling everything, include the
> OS from scratch. :-)

Uh-uh. So this implies that there may be some settings tucked away in
some place where I can't get to? But it seems as if both installation
scripts for mod_python and psycopg2 can find and read this faulty
setting, since they both put their packages in the funny python2.5/
site-packages/ beneath my python2.4 path.

> 1. Why are you using Apache 2.1. The Apache 2.1 stream was a
> developmental version stream, it should not be used for production
> use. You should use either Apache 2.0.X or Apac 2.2.X streams.

Sorry for giving you the wrong Apache version. I checked with MacPorts
and I am in fact running Apache 2.2.6 and it was this version I
pointed at while compiling the mod_python.

> 2. When building mod_python, you should use --with-python option to
> indicate an alternate version of Python to use.

Yes, I did point at my Python 2.4. Here is the config command I used:
./configure --with-apxs=/opt/local/apache2/bin/apxs --with-python=/
Library/Frameworks/Python.framework/Versions/2.4/bin/python

When I did my trials with Python 2.5, I also pointed at that version
in the compilation, but still got a mod_python that said it was
compiled for running Python 2.4 as a result.

> 3. Often with MacPorts versions of Python, when building mod_python
> you must manually edit the src/Makefile to insert additional linker
> option into LDFLAGS to indicate where the Python framework libraries
> are for the version of Python being used. For example, something like:
>
>   LDFLAGS = -Wl,-F/opt/local/Library/Frameworks 

OK, thanks. I saw a note about that somewhere, and I used it while
trying with Python 2.5. I'll have a check if this points the wrong way
for my Python 2.4 compilation. Right now it looks like this:
LDFLAGS= -Wl,-framework,Python  -u _PyMac_Error $(PYTHONFRAMEWORKDIR)/
Versions/$(VERSION)/$(PYTHONFRAMEWORK) ...

Do you think I should replace the -Wl,-framework,Python part with:
-Wl,-F/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-
packages/   ?

> 4. When running Apache with that mod_python version, the PATH of the
> user that Apache runs as must find first the version of the 'python'
> executable you specified to the --with-python option before any other
> versions of Python. This can be done by setting the PATH environment
> variable appropriately in the 'envvars' file in the same directory as
> the Apache httpd program executable.

Aha. So would that be like an ordinary $PATH setting in my
bash .profile?:
export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:
${PATH}"

The thing is that I right now have a working environment, but I feel a
bit nervous about the fact that packages install in the wrong
directory out of my control.

Sooner or later, I also have to go up to Python 2.5 for my scripting,
since I need that version for some unicode-related hacks, due to the
lack of unicode handling in the CSV package I use for loading my data.
Before this havoc, I was running python 2.5 for my scripts and python
2.4 for the web server (without knowing it). When I install python
2.5, do you think I should use the MacPorts version or the DMG
version?

Thanks for your help,
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
-~--~~~~--~~--~--~---



Re: Anyone running mod_python for Python 2.5 on Mac OS X?

2007-10-20 Thread Graham Dumpleton

A few quick comments, although you may have so mucked up your
installations you might be better reinstalling everything, include the
OS from scratch. :-)

1. Why are you using Apache 2.1. The Apache 2.1 stream was a
developmental version stream, it should not be used for production
use. You should use either Apache 2.0.X or Apac 2.2.X streams.

2. When building mod_python, you should use --with-python option to
indicate an alternate version of Python to use.

3. Often with MacPorts versions of Python, when building mod_python
you must manually edit the src/Makefile to insert additional linker
option into LDFLAGS to indicate where the Python framework libraries
are for the version of Python being used. For example, something like:

  LDFLAGS = -Wl,-F/opt/local/Library/Frameworks 

4. When running Apache with that mod_python version, the PATH of the
user that Apache runs as must find first the version of the 'python'
executable you specified to the --with-python option before any other
versions of Python. This can be done by setting the PATH environment
variable appropriately in the 'envvars' file in the same directory as
the Apache httpd program executable.

Graham

On Oct 19, 11:59 pm, Ulf Kronman <[EMAIL PROTECTED]> wrote:
> 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,