[mod_python] trying to upgrade to Python2.4, Apache2.0.53, Mod_Python3.1.4 on Mac OsX

Ron Reisor ron at udel.edu
Wed Feb 16 09:06:05 EST 2005


The python that comes with MacOSX, currently 10.3.8, is /usr/bin/python 
and it appears to be 2.3.  Not 2.3.4 or 2.3.5, but 2.3.

The Apple built framework for this python is in /System/Library/Frameworks 
and this is where the shared libraries and other things, includeing the 
site-packages directory that works with this version of python. 
/usr/bin/python gets you all of this and the pieces all fit together.

If you build Python-2.4 using ./configure --enable-framework, it will 
build into /usr/local/bin/python and ignore the Apple built python 
libraries.

The default place for the framework will be /Library/Frameworks which is 
where user added frameworks go. Apple does put some of there own software 
there, like Compressor and Motion, but these are libraries not used by the 
System.  If you build your own python framework, it'll be in 
/Library/Frameworks and not clash with the /System/Library/Frameworks 
version.

The framework build works well, fits in best with Apple's dyld which is 
best in tune with these fancy dynamic libraries, and the Python developers 
support it well.

cheers,

Ron


On Tue, 15 Feb 2005, Graham Dumpleton wrote:

> The problem is that the libpython2.4.a is a static library and there
> is not a dynamically loadable library. See following comment from the
> mod_python README file:
>
>  3. On Darwin, libpython cannot be linked statically with mod_python
>  using libtool. libpython has to be a dynamic shared object. The Python
>  distribution does not provide a way of building libpython as a shared
>  library, but the Fink Python distribution comes with one
>  (/sw/lib/python2.2/config/libpython2.2.dylib), so the easiest thing is
>  to install Python from Fink (fink.sourceforge.net).
>
> I would assume the same comment applies if building your own version
> of Python on full MacOSX and where a framework install wasn't done.
>
> Normally with a framework install, the dynamically loadable version is
> installed under the framework package as:
>
>  /System/Library/Frameworks/Python.framework/Versions/2.3/Python
>
> If you run "otool -L" on your old mod_python.so which used standard
> Python version, that is what you should have seen.
>
> Your options thus seem to be:
>
> 1. Use standard Python 2.3 shipped with MacOSX.
>
> 2. Use Python 2.4 provided with "fink" packages.
>
> 3. Install Python 2.4 as a framework but make sure you install it
> such that you don't overwrite the standard Python installation.
>
> The safest and quickest thing to do is use Python 2.3 shipped with
> the box. Using fink means a lot of crap get installed on your box
> that you might not want. Installing Python 2.4 runs the risk of
> trashing your system version of Python if you do the wrong thing.
>
> Graham
>
> John Raines wrote ..
>> The libraries certainly seem to be there:
>>
>> jraines-Computer:/usr/local jrraines$ ls lib/python2.4/config
>> Makefile        Setup           Setup.config    Setup.local
>> config.c        config.c.in     install-sh      libpython2.4.a
>> makesetup       python.o
>> jraines-Computer:/usr/local jrraines$ ls
>> lib/python2.4/site-packages/mod_python
>> Cookie.py       Session.py      __init__.py     _psp.so
>> apache.pyo      cgihandler.pyo  psp.pyo         publisher.pyo
>> util.pyo
>> Cookie.pyc      Session.pyc     __init__.pyc    apache.py
>> cgihandler.py   psp.py          publisher.py    util.py
>> Cookie.pyo      Session.pyo     __init__.pyo    apache.pyc
>> cgihandler.pyc  psp.pyc         publisher.pyc   util.pyc
>>
>> jraines-Computer:/usr/local jrraines$ ls
>> apache2 bin     include lib     man     share
>>
>> jraines-Computer:/usr/local jrraines$ ls bin
>> AlchemyTVSetTuner       pcpmac                  pmvmac
>> psync                   python2.4
>> idle                    pgetfinfo               psetfinfo
>> pydoc                   smtpd.py
>>
>> jraines-Computer:/usr/local jrraines$ ls lib/python2.4/lib-dynload
>> ColorPicker.so          _Evt.so                 _Qt.so
>> _csv.so                 audioop.so              gestalt.so
>> regex.so
>> MacOS.so                _File.so                _Res.so
>> _curses.so              autoGIL.so              grp.so
>> resource.so
>> Nav.so                  _Fm.so                  _Scrap.so
>> _curses_panel.so        binascii.so             icglue.so
>> rgbimg.so
>> OSATerminology.so       _Folder.so              _Snd.so
>> _heapq.so               bsddb185.so             imageop.so
>> select.so
>> _AE.so                  _Help.so                _TE.so
>> _hotshot.so             bz2.so                  itertools.so
>> sha.so
>> _AH.so                  _IBCarbon.so            _Win.so
>> _locale.so              cPickle.so              math.so
>> strop.so
>> _App.so                 _Icn.so                 _bisect.so
>> _multibytecodec.so      cStringIO.so            md5.so
>> struct.so
>> _CF.so                  _Launch.so              _bsddb.so
>> _random.so              cmath.so                mmap.so
>> syslog.so
>> _CG.so                  _List.so                _codecs_cn.so
>> _socket.so              collections.so          nis.so
>> termios.so
>> _CarbonEvt.so           _Menu.so                _codecs_hk.so
>> _ssl.so                 crypt.so                operator.so
>> time.so
>> _Cm.so                  _Mlte.so                _codecs_iso2022.so
>> _testcapi.so            datetime.so             parser.so
>> timing.so
>> _Ctl.so                 _OSA.so                 _codecs_jp.so
>> _tkinter.so             dbm.so                  pwd.so
>> unicodedata.so
>> _Dlg.so                 _Qd.so                  _codecs_kr.so
>> _weakref.so             fcntl.so                pyexpat.so
>> zlib.so
>> _Drag.so                _Qdoffs.so              _codecs_tw.so
>> array.so                gdbm.so                 readline.so
>>
>> I thought linking Mod_Python to the Python 2.4 code was taken care of
>> by the "--with-python=/usr/local/bin/python2.4" ? It seems to have
>> gotten the site-packages directory put into the right location.
>>
>> On Feb 15, 2005, at 5:50 PM, Graham Dumpleton wrote:
>>
>>> If you really want to use Python 2.4, you are going to have to somehow
>>> force a reference to the Python library in mod_python.so. Since you
>>> aren't
>>> using a framework install, not sure what the library is you have to
>>> force
>>> link with. You might want to look for Python related libraries in such
>>> directories as:
>>>
>>>   /usr/local/lib
>>>   /usr/local/lib/python2.4/config
>>>
>>> BTW, is there anything you really want in Python 2.4? Especially if
>>> you are
>>> a UNIX novice, trying to host two different versions of Python on
>>> MacOSX
>>> can be a problem. I guess at least you didn't use a framework install
>>> and
>>> do it on top of the system supplied version of Python. Doing that can
>>> really screw things up bad.
>>>
>>> The only catch on using standard MacOSX Python installation is that you
>>> need to patch src/mod_python.c file in source to workaround a problem
>>> with it. Use of "worker" may also trigger some other mod_python bugs.
>>> Fixes for both are detailed in:
>>>
>>>   http://www.dscpl.com.au/projects/vampire/PATCHES
>>>
>>> Graham
>>>
>>> John Raines wrote ..
>>>> My website had been stable and running without error but I'd been
>>>> running on 2.3.3, 2.0.52 and 3.1.3; since everything was behind the
>>>> times I decided to finally reinstall; I made the mistake of doing it
>>>> on
>>>> the drive that everything was being served off of instead of using my
>>>> backup drive. :-(
>>>>
>>>> I installed python 2.4 and it seems to work when I call it from the
>>>> shell. I did not do a frameworkInstall, which seems to be recommended
>>>> by some people. I am too much of a unix novice to understand what the
>>>> implications of frameworkInstall are. I installed apache and
>>>> mod_python
>>>> as follows:
>>>>
>>>> cd ~/Desktop/httpd-2.0.53
>>>> ./configure --enable-so --with-mpm=worker
>>>> make
>>>> sudo make install
>>>>
>>>> cd ~/Desktop/mod_python-3.1.4
>>>> ./configure --with apxs=/usr/local/apache2/bin/apxs
>>>> --with-python=/usr/local/bin/python2.4
>>>> make
>>>> sudo make install
>>>>
>>>> I restored my old httpd.conf file and my website files. My index.html
>>>> file is straight html which links to .py files. As soon as I try to
>>>> access any of the .py stuff I now get an internal server error message
>>>> and the server log shows this:
>>>>
>>>> [Tue Feb 15 16:25:25 2005] [notice] mod_python: Creating 32 session
>>>> mutexes based on 6 max processes and 25 max threads.
>>>> [Tue Feb 15 16:25:25 2005] [notice] Apache configured -- resuming
>>>> normal operations
>>>> [Tue Feb 15 16:25:36 2005] [error] make_obcallback: could not import
>>>> mod_python.apache.\n
>>>> Traceback (most recent call last):
>>>>    File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py",
>>>> line 22, in ?
>>>>      import time
>>>> ImportError: Failure linking new module: : dyld:
>>>> /usr/local/apache2/bin/httpd Undefined symbols:
>>>> /usr/local/lib/python2.4/lib-dynload/time.so undefined reference to
>>>> _PyArg_Parse expected to be defined in the executable
>>>> /usr/local/lib/python2.4/lib-dynload/time.so undefined reference to
>>>> _PyArg_ParseTuple expected to be defined in the executable
>>>> /usr/local/lib/python2.4/lib-dynload/time.so undefined reference to
>>>> _PyDict_GetItemString expected to be defined in the executable
>>>> /usr/local/lib/python2.4/lib-dynload/time.so un
>>>>                                                               <--what
>>>> happened here??
>>>> [Tue Feb 15 16:25:36 2005] [error] make_obcallback: could not import
>>>> mod_python.apache.
>>>>
>>>> for what its worth I can access various parts of the time module when
>>>> I
>>>> run Python2.4 from the shell.
>>>>
>>>> Going back through the the mailing list I saw that Graham Dumpleton
>>>> (back on Dec 23) suggested the output from this might be useful; what
>>>> I
>>>> get is different from what he saw but I'm not sure what to make of my
>>>> result:
>>>>
>>>> jraines-Computer:~/Desktop/Website jrraines$ otool otool -L
>>>> /usr/local/apache2/modules/mod_python.so
>>>> otool: can't open file: otool (No such file or directory)
>>>> /usr/local/apache2/modules/mod_python.so:
>>>>          /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
>>>> current version 71.1.1)
>>>>
>>>> jraines-Computer:~/Desktop/Website jrraines$ ls
>>>> /usr/local/apache2/modules
>>>> httpd.exp       mod_python.so
>>>>
>>>> My problem seemed like it might be similar to a thread titled Weird
>>>> ob_callback problems at the end of Jan. I tried the suggestions Grisha
>>>> made:Try defining DYLD_FORCE_FLAT_NAMESPACE=1 environment variable
>>>> before launching httpd.
>>>> That didn't help either.
>>>>
>>>> _______________________________________________
>>>> 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
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>

Ron Reisor <ron at udel.edu> (RWR3)
University of Delaware Information Technologies/Network and Systems Services
Computing Center/192 South Chapel Street/Newark DE, 19716
pgp finger print: 0D 73 06 6F D3 6A 99 D3  F5 D5 6E FF 3B B9 7C 2C


More information about the Mod_python mailing list