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

Eeswar Kameswara Rao eeswar at pbsystems.com
Mon Apr 20 03:23:42 EDT 2009


That's True Graham.

I installed the Python 2.3.5 from source.

Regards,
Eeswar
________________________________________
From: Graham Dumpleton [graham.dumpleton at gmail.com]
Sent: Monday, April 20, 2009 12:32 PM
To: Eeswar Kameswara Rao
Cc: mod_python at modpython.org
Subject: Re: [mod_python] mod_python: How-to Resolve Python Version conflicts

2009/4/18 Eeswar Kameswara Rao <eeswar at pbsystems.com>:
> Thank you Graham for the immediate  response.
>
> Sorry I could not reply immediately.
> I have actually figured the solution and fell asleep (work in a different time zone).
>
> I missed to mention the following facts: -
> 1. I have two different users for each of the Python versions
> 2. One user runs on Python 2.5.1 and another user on Python 2.3.5

I still don't understand where Python 2.3.5 came from as a complete
Python 2.3.5 installation is not supplied with MacOS X 10.5. Did you
install your own Python 2.3.5 from source code? Did you install that
under /System/Library?

Anyway, as long as you have got it work and are happy.

Graham

> 3. I run Mac OSX 10.5.6 with latest updates
> 4. For each of the users the default python PATHS are setup so that each gets his/her own version of python at command prompt
>
>
> Changes I made to make Python 2.5 and 2.3 co-exist without interfering with each other
> ------------------------------------------------------------------------------------------------------------
> 1. I modified the symlink /System/Library/Frameworks/Python/Versions/Current  point to 2.5
> 2. Then redid the following
> ./configure --with-ptyhon=/usr/bin/python2.5
> Modified the paths in Makefile to point to Python2.5
> Added '-arch i386' options wherever required in the Makefile
> make && sudo make install
> 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.5/Python (compatibility version 2.5.0, current version 2.5.1)
>>        /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
>
> I have reset the symlink Current to 2.3.
>
> Note
> -------
> 1. Looks like the symlink '/System/Library/Frameworks/Python/Versions/Current ' plays a very important role up to creating the mod_python.so.
> 2. Now I am able to run the python web-apps from any login irrespective of which python version access is provided to
>
> INFERENCES (please validate these)
> ---------------------------------------------------------
> 1. Web-based python does not include command-prompt based python
> 2. All python web-apps refer only to mod_python
> 3. Command prompt Python refers to the PATH variable in the Shell's ENV variables whereas mod_python refers to its own internal path settings for python version (which probably got create during the 'Configure and Make')
> 3. Mod-python uses the python settings provided during the "./configure --with-python=" and the settings provided in the python paths of Makefile
> 4. Specifying Architecture is an important component for creating a workable mod_python
>
>
> Regards,
> Eeswar
> ________________________________________
> From: Graham Dumpleton [graham.dumpleton at gmail.com]
> Sent: Saturday, April 18, 2009 3:45 AM
> To: Eeswar Kameswara Rao
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] mod_python: How-to Resolve Python Version conflicts
>
> 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
>>
>



More information about the Mod_python mailing list