[mod_python] mod_python: How-to Resolve Python Version conflicts

Graham Dumpleton graham.dumpleton at gmail.com
Fri Apr 17 19:50:46 EDT 2009


Whoops, didn't even notice this wasn't the original poster, so more
confusion. Anyway, they raised a valid point which I had forgotten
about, which was that there is a partial installation of 2.3 on
Leopard.

The advice of using mod_python source from subversion still stands. If
there is still an issue then, I would be concerned about that Current
link in Python framework directory.

Graham

2009/4/18 Graham Dumpleton <graham.dumpleton at gmail.com>:
> 2009/4/18 Andrew Smith <andy at robotlovesyou.com>:
>> Actually, to my knowledge, OS X 10.5 comes with python 2.5 and python 2.3
>> installed by default. At least that is the way it appears to be on my
>> system.
>
> It does and it doesn't. The 2.3 version can't be run as command line
> instance and bits are missing such that you cannot even compile
> against it for an embedded system. It is only of use where you have
> brought an embedded system binary from Tiger which was compiled
> against it on Tiger.
>
> Thus, 2.3 on Leopard should be completely ignored. That you were even
> mentioning it made me wrongly thing you had done something wrong with
> your system. That is, so completely ignore 2.3 on Leopard that I had
> forgot it was there.
>
>> Eeswar, which version of OS X are you running?
>
> Tiger and Leopard.
>
>> What is the output if you run
>>
>> python -V
>
> $ python -V
> Python 2.5.1
>
>> at the command line
>>
>> what is the output if you
>>
>> cd /usr/bin
>> ls -l py*
>
> For Leopard.
>
> $ ls -las py*
> 8 lrwxr-xr-x  1 root  wheel  71 16 Nov  2007 pydoc ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pydoc
> 8 lrwxr-xr-x  1 root  wheel  74 16 Nov  2007 pydoc2.5 ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pydoc2.5
> 8 lrwxr-xr-x  1 root  wheel  72 16 Nov  2007 python ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
> 8 lrwxr-xr-x  1 root  wheel  79 16 Nov  2007 python-config ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python-config
> 8 lrwxr-xr-x  1 root  wheel  75 16 Nov  2007 python2.5 ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5
> 8 lrwxr-xr-x  1 root  wheel  82 16 Nov  2007 python2.5-config ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5-config
> 8 lrwxr-xr-x  1 root  wheel  73 16 Nov  2007 pythonw ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw
> 8 lrwxr-xr-x  1 root  wheel  76 16 Nov  2007 pythonw2.5 ->
> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
>
> This is all likely going to be the same as you have.
>
> More importantly, what do you have for:
>
> $ cd /System/Library/Frameworks/Python.framework/Versions
>
> $ ls -las
> total 8
> 0 drwxr-xr-x   5 root  wheel  170 16 Nov  2007 .
> 0 drwxr-xr-x   7 root  wheel  238  9 Nov 21:48 ..
> 0 drwxr-xr-x   7 root  wheel  238 16 Nov  2007 2.3
> 0 drwxr-xr-x  11 root  wheel  374 21 Feb 14:27 2.5
> 8 lrwxr-xr-x   1 root  wheel    3 16 Nov  2007 Current -> 2.5
>
> If that Current link has been changed then it will pick up wrong
> framework at run time and cause lots of problems.
>
> In all, I probably think the problem is that you hand doctored
> makefiles to get anything to work on Leopard and got it wong. For
> example, the following is wrong:
>
>  -framework Python
> -Wl,-F/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
>
> So, rather than try and fudge things yourself, just check out latest
> version of mod_python from subversion repository.
>
>  svn co https://svn.apache.org/repos/asf/quetzalcoatl/mod_python/trunk
> mod_python-trunk
>
> and use it as it has fixes to work on Leopard.
>
> If you don't actually need features of mod_python and just want to
> host Django, Trac or some other WSGI capable application, use mod_wsgi
> instead.
>
> BTW, please use reply-all and keep followups on list.
>
> Graham
>
>> Andy
>>
>> 2009/4/17 Graham Dumpleton <graham.dumpleton at gmail.com>
>>>
>>> You may well have screwed up your operating system Python
>>> installation. You should never install separate Python versions under
>>> /System/Library as that is reserved for operating system supplied
>>> packages. You should also never change /usr/bin/python to put at some
>>> other version because if operating system functions are dependent on
>>> the version that was there previously, you will cause those bits of
>>> the operating system to fail.
>>>
>>> Since your operating system is now in such an unknown state of
>>> functioning, there isn't probably much point trying to pursue why you
>>> have problems.
>>>
>>> Next time install the alternate Python under /Library or better still
>>> /usr/local and don't stuff with /usr/bin/python. Then as per
>>> instructions for mod_python, use the --with-python option to configure
>>> script to say which version of Python you want to use rather than
>>> trying to hand edit things as you likely aren't changing everything
>>> that would need to be different when different Python version used.
>>>
>>> Graham
>>>
>>> 2009/4/18 Eeswar Kameswara Rao <eeswar at pbsystems.com>:
>>> > Hello All,
>>> >
>>> > I am new to this list. I am having trouble to access the archives.
>>> >
>>> > Here is my problem. PLEASE HELP.
>>> >
>>> > ISSUE
>>> > ---------
>>> > 1. After I do "make && sudo make install" I get a mod_python.so in the
>>> > src and .libs directories
>>> > 2. When I do a 'otool -L ./mod_python.so'  it reports
>>> > www:src Tool$ otool -L mod_python.so
>>> > mod_python.so:
>>> >        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
>>> > version 111.1.3)
>>> >        /System/Library/Frameworks/Python.framework/Versions/2.3/Python
>>> > (compatibility version 2.3.0, current version 2.3.5)
>>> >        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
>>> > version 1.0.0)
>>> >
>>> > SCENARIO
>>> > ---------------
>>> > 1. H/W - Intel Core2Duo MacBook laptop
>>> > 2. I have two versions of Python i.e. 2.3 and 2.5.1
>>> > 3. Python 2.3 path is
>>> > /System/Library/Frameworks/Python.framework/Versions/2.3/
>>> > 4. Python2.3 executable is in /usr/local/sbin
>>> > 5. Python2.5 path is
>>> > /System/Library/Frameworks/Python.framework/Versions/2.5/
>>> > 6. Python2.5 Executable is in /usr/bin
>>> > 7. Apache version 2.0 is enabled in 32-bit mode (reconfigured the apache
>>> > plist for 32-bit)
>>> > 8. Ran .sudo ./configure --with-python=/usr/bin/python2.5
>>> > 9. Added to Makefile with library path pointing to Python2.5 in LDFLAGS
>>> > 10. Added to Makefile '-arch i386' to LDFLAGS, CFLAGS and under
>>> > mod_python.so
>>> > 11. After doing a "make && sudo make install" I get a mod_python.so
>>> > built with Python2.3 framework (????)
>>> >
>>> > I want this mod_python to be Python2.5 compliant ONLY.
>>> >
>>> > So all my Python web apps crash. Error_logs report version conflicts.
>>> >
>>> > Below is the listing from "make && sudo make install'
>>> >
>>> > www:mod_python-3.3.1 Tool$ make && sudo make install
>>> >
>>> > Compiling for DSO.
>>> >
>>> > /usr/sbin/apxs -I/Users/Tool/mod_python-3.3.1/src/include
>>> > -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> > -c -Wc,"-arch i386" mod_python.c _apachemodule.c requestobject.c
>>> > tableobject.c util.c serverobject.c connobject.c filterobject.c hlist.c
>>> > hlistobject.c finfoobject.c -Wl,-framework,Python  -u _PyMac_Error
>>> > -framework Python
>>> > -Wl,-F/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
>>> > -arch i386   -lm  -framework  Python    -ldl
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o mod_python.lo mod_python.c && touch mod_python.slo
>>> > mod_python.c: In function 'python_init':
>>> > mod_python.c:826: warning: initialization from incompatible pointer type
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o _apachemodule.lo _apachemodule.c && touch _apachemodule.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o requestobject.lo requestobject.c && touch requestobject.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o tableobject.lo tableobject.c && touch tableobject.slo
>>> > tableobject.c:329: warning: initialization from incompatible pointer
>>> > type
>>> > tableobject.c:1092: warning: initialization from incompatible pointer
>>> > type
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o util.lo util.c && touch util.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o serverobject.lo serverobject.c && touch serverobject.slo
>>> > serverobject.c:387: warning: initialization from incompatible pointer
>>> > type
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o connobject.lo connobject.c && touch connobject.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o filterobject.lo filterobject.c && touch filterobject.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o hlist.lo hlist.c && touch hlist.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o hlistobject.lo hlistobject.c && touch hlistobject.slo
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN
>>> > -DSIGPROCMASK_SETS_THREAD_MASK -no-cpp-precomp  -I/usr/include/apache2
>>> >  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch i386
>>> > -I/Users/Tool/mod_python-3.3.1/src/include -I/usr/include/apache2
>>> > -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>>> >  -c -o finfoobject.lo finfoobject.c && touch finfoobject.slo
>>> > finfoobject.c:278: warning: 'intargfunc' is deprecated
>>> > finfoobject.c:278: warning: initialization from incompatible pointer
>>> > type
>>> > /usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o
>>> > mod_python.la  -rpath /usr/libexec/apache2 -module -avoid-version
>>> >  finfoobject.lo hlistobject.lo hlist.lo filterobject.lo connobject.lo
>>> > serverobject.lo util.lo tableobject.lo requestobject.lo _apachemodule.lo
>>> > mod_python.lo -Wl,-framework,Python -u _PyMac_Error -framework Python
>>> > -Wl,-F/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
>>> > -arch i386 -lm -framework Python -ldl
>>> > make[2]: `psp_parser.c' is up to date.
>>> > /usr/bin/python2.5 setup.py build
>>> > running build
>>> > running build_py
>>> > running build_ext
>>> >
>>> > Now su and make install
>>> >  (or, if you only want to perform a partial install,
>>> >   you can use make install_dso and make install_py_lib)
>>> >
>>> > Password:
>>> > make[3]: `psp_parser.c' is up to date.
>>> > /usr/bin/python2.5 setup.py build
>>> > running build
>>> > running build_py
>>> > running build_ext
>>> >
>>> > Now su and make install
>>> >  (or, if you only want to perform a partial install,
>>> >   you can use make install_dso and make install_py_lib)
>>> >
>>> >
>>> > Performing DSO installation.
>>> >
>>> > /usr/bin/install -c -d /usr/libexec/apache2
>>> > /usr/bin/install -c src/mod_python.so /usr/libexec/apache2
>>> >
>>> > Now don't forget to edit your main config and add
>>> >    LoadModule python_module /usr/libexec/apache2/mod_python.so
>>> > and if your configuration uses ClearModuleList, then also
>>> >    AddModule mod_python.c
>>> >
>>> > cd dist && make install_py_lib
>>> > make[3]: `psp_parser.c' is up to date.
>>> > if test -z "" ; then \
>>> >                /usr/bin/python2.5 setup.py install --optimize 2 --force
>>> > ; \
>>> >        else \
>>> >                /usr/bin/python2.5 setup.py install --optimize 2 --force
>>> > --root  ; \
>>> >        fi
>>> > running install
>>> > running build
>>> > running build_py
>>> > running build_ext
>>> > running install_lib
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/__init__.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/_psp.so ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/apache.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/cache.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/cgihandler.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/Cookie.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/importer.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/psp.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/publisher.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/python22.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/Session.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/testhandler.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > copying build/lib.macosx-10.5-i386-2.5/mod_python/util.py ->
>>> > /Library/Python/2.5/site-packages/mod_python
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/__init__.py
>>> > to __init__.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/apache.py to
>>> > apache.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/cache.py to
>>> > cache.pyc
>>> > byte-compiling
>>> > /Library/Python/2.5/site-packages/mod_python/cgihandler.py to cgihandler.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/Cookie.py to
>>> > Cookie.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/importer.py
>>> > to importer.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/psp.py to
>>> > psp.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/publisher.py
>>> > to publisher.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/python22.py
>>> > to python22.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/Session.py
>>> > to Session.pyc
>>> > byte-compiling
>>> > /Library/Python/2.5/site-packages/mod_python/testhandler.py to
>>> > testhandler.pyc
>>> > byte-compiling /Library/Python/2.5/site-packages/mod_python/util.py to
>>> > util.pyc
>>> > writing byte-compilation script '/tmp/tmpG6QrK-.py'
>>> >
>>> > /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python
>>> > -OO /tmp/tmpG6QrK-.py
>>> > removing /tmp/tmpG6QrK-.py
>>> > running install_egg_info
>>> > Removing
>>> > /Library/Python/2.5/site-packages/mod_python-3.3.1-py2.5.egg-info
>>> > Writing
>>> > /Library/Python/2.5/site-packages/mod_python-3.3.1-py2.5.egg-info
>>> > www:mod_python-3.3.1 Tool$ cd src
>>> > www:src Tool$ ls
>>> > Makefile                connobject.lo           hlist.lo
>>> >  mod_python.slo          serverobject.o
>>> > Makefile.in             connobject.o            hlist.o
>>> > mod_python.so           serverobject.slo
>>> > Makefile.txt            connobject.slo          hlist.slo
>>> > mod_python.vcproj       tableobject.c
>>> > Makefile_bak            filterobject.c          hlistobject.c
>>> > psp_parser.c            tableobject.lo
>>> > Makefile_bak_16MAR      filterobject.lo         hlistobject.lo
>>> >  psp_parser.l            tableobject.o
>>> > Version.rc              filterobject.o          hlistobject.o
>>> > psp_string.c            tableobject.slo
>>> > _apachemodule.c         filterobject.slo        hlistobject.slo
>>> > requestobject.c         util.c
>>> > _apachemodule.lo        finfoobject.c           include
>>> > requestobject.lo        util.lo
>>> > _apachemodule.o         finfoobject.lo          mod_python.c
>>> >  requestobject.o         util.o
>>> > _apachemodule.slo       finfoobject.o           mod_python.la
>>> > requestobject.slo       util.slo
>>> > _pspmodule.c            finfoobject.slo         mod_python.lo
>>> > serverobject.c
>>> > connobject.c            hlist.c                 mod_python.o
>>> >  serverobject.lo
>>> > www:src Tool$ otool -L mod_python.so
>>> > mod_python.so:
>>> >        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
>>> > version 111.1.3)
>>> >        /System/Library/Frameworks/Python.framework/Versions/2.3/Python
>>> > (compatibility version 2.3.0, current version 2.3.5)
>>> >        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
>>> > version 1.0.0)
>>> > www:src Tool$ file mod_python.so
>>> > mod_python.so: Mach-O bundle i386
>>> >
>>> >
>>> > PLEASE HELP.
>>> >
>>> > Thanks and Regards,
>>> > Eeswar
>>> >
>>> >
>>> > _______________________________________________
>>> > Mod_python mailing list
>>> > Mod_python at modpython.org
>>> > http://mailman.modpython.org/mailman/listinfo/mod_python
>>> >
>>>
>>> _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
>>
>



More information about the Mod_python mailing list