PyROOT, fink, and libpythonx.y.so

I’m running Mac OS X 10.5.1 and have Python 2.5.1 downloaded from fink. I also obtained ROOT through the SVN trunk (5.17/05). The manual specifies that you should set libdir to the folder that contains libpythonx.y.so. The problem is: this file doesn’t (seem to) exist! The closest thing I can find is libpython2.5.dylib which I don’t think counts. There’s also a libpython2.5.a. When I’ve run ./configure macosx --enable-python with specifications for libdir and incdir, it says Python’s enabled, but after make, I get a version mismatch? error.

I’m aware that version mismatch errors arise if there are more than one Python installation (I’ve run into those), and I’ve deleted MacPython / all the Python.framework stuff in System/Library, and all my Python info is in /sw via fink.

Is there anything to be done to import ROOT at the Python prompt? I realize the .so search is more of a fink issue, but is the only way to reinstall Python from the 10.5 disc, so that specifying this .so isn’t an issue?

Hi,

creating a symlink libpythonx.y.so to the libpythonx.y.dylib should do the trick. The default install on Mac is to look for the Python framework though.

You get a version mismatch (rather common), because you have two pythons on your system and you’re running with one while building against the other.
Usually a link problem or runtime problem (LD_LIBRARY_PATH and/or DYLD_LIBRARY_PATH, I forget).

See http://savannah.cern.ch/bugs/?22003 and http://root.cern.ch/phpBB2/viewtopic.php?t=3226 for more details.

Btw, AFAIK, MacOS 10.5 comes with Python2.5.1 out-of-the box, so why bother with fink and risk inconsistencies like you do?

Cheers,
Wim

Hi, thanks for the reply. I tried the suggestions but I get the same error.

I made the symlink:

and then I ran the configure script:

These directories contain the headers and symlink.
My PATH (etc.) looks like:

After the build, ROOT runs fine, Python runs fine, but

When I ran otool on Python2.5.dylib, I got

So it seems that libpython2.5.dylib is connected to Python 2.5.0, but I have Python 2.5.1. Could this be the problem? If so, is there any way to force compatibility?

Also, I already had numpy and scipy via fink, so I decided to keep on using it for ROOT–I don’t have any Python.framework files now.

Thanks again…

Hi,

yes, that’s a foolproof way of getting the error you observe. You won’t find the problem with numpy likely because it does not link with libpython.

Can you move /sw/bin up in $PATH? I’m thinking that you get 2.5.1 from normal /System, and 2.5.0 from fink. Or run /sw/bin/python to start the fink one (and even if you installed 2.5.1 with fink, it should still be that the python that corresponds to the libpythonx.y lib is the one chosen).

An alternative is to rebuild libPyROOT w/o linking with libpythonx.y.so and adding that lib to $ROOTSYS/lib/libPyROOT.rootmap. I’ve got that recipe nailed on Linux, but still not finalized on Mac (for which I’m doing it …).

Cheers,
Wim

I moved it to the “front” of $PATH and rebuilt–no good. I did verify that the python command at the prompt is the one in /sw/bin/ though and it is 2.5.1 from fink. (frustrating since the .dylib is from this fink download!)

Could you outline how you do this (at least for Linux) and maybe I can get it to work on the Mac (PowerBook PPC G4)?

Thanks.

Hi,

easiest way to do it directly is to change pyroot/Module.mk and add:PYTHONLIBDIR := PYTHONLIB := PYROOTLIBDEPM := /sw/lib/libpython2.5.so
where I’m assuming that your libpython2.5.so is located in /sw/lib (it doesn’t really matter, though).

Then rm -rf $ROOTSYS/lib/libPyROOT.* and make again. After that, libPyROOT is no longer linked with python, and for use of TPython from CINT, the libPyROOT.rootmap file tells it to load libpython2.5.so.

Cheers,
Wim

P.S. The hard part is not the above, but having all behave properly in all cases (e.g. if no shared library exist, if there is a framework install, if additional libs such as util are needed, etc.).