I am having a difficult time installing PyRoot on my PPC OS X (version 10.4.10) machine. Reading some posts in this forum has helped, but I’m still getting errors.
I downloaded the current version of ROOT 5.16 to /usr/local/root through cvs and configured it as follows:
sudo ./configure --prefix=$ROOTSYS --etcdir=$ROOTSYS/etc --libdir=$ROOTSYS/lib --incdir=$ROOTSYS/include --enable-python --with-python-incdir=/opt/local/Library/Frameworks/Python.framework/Headers --with-python-libdir=/opt/local/Library/Frameworks/Python.framework --enable-minuit2
A few interesting notes:
- I cannot find a libpython2.4.so file (there was a libpython2.4.a and libpython2.4.dylib file).
- I do have a couple of versions of python installed. The native version, one through fink, and one called MacPython. All are version 2.4. The one that runs I execute ‘python’ is the native system version located in /Library/Frameworks/Python.framework/Versions/2.4/bin/python
- The --enable-framework flag does not work. I get an ‘Invalid option’ error.
After the ./configure I ‘sudo make install’
If I launch python and try ‘import ROOT’ I get the following error.
Traceback (most recent call last):
File “”, line 1, in ?
File “/usr/local/root/lib/ROOT.py”, line 83, in ?
import libPyROOT as _root
ImportError: Inappropriate file type for dynamic loading
In .bash_profile I have set the following variables
Do I need to rebuild python?
Any help would be appreciated.
python2.4 is older than Mac OS-X 10.4. In 10.4, the definition of a loadable shared library changed, and Apple changed the python Makefile explicitly to reflect this for their system python. That change isn’t in p2.4. Follow the instructions and discussion here: http://root.cern.ch/phpBB2/viewtopic.php?t=3226&start=23
Yes, you need to rebuild python. Moving to p2.5 would be even better and solve many Mac-related p2.4 problems.
The new version of python v2.51 was successfully installed. ROOT was rebuilt upon the new version. Now when I ‘import ROOT’ I receive the following fatal message, the same message Emanuele received in your linked post:
Fatal Python error: Interpreter not initialized (version mismatch?)
Any ideas? It didn’t seem like the issue was resolved the first time.
is a common problem on Mac … it means that you are running with a different python than the one that has been built against. Like I posted in the other thread … output from otool?
Myself, I’ve never been able to resolve the above on a custom python other than through an ordinary framework build in the normal place. Stefan, however, managed to get it working, though: http://savannah.cern.ch/bugs/?22003
Where did you put your p2.5 install?
I used a standard framework install from a universal installer for PPC and Intel macs located at the python.org web site. I checked, and it put everything in the standard location, i.e. /Library/Frameworks/Python.framework/…
I tried to run otool -L libPyROOT.so, but it appears like I don’t have the necessary file on my machine.
Do you think my compilation flags are incorrect?
Thank your for your help,
well, unless I missed them, I don’t know what your latest options are, just that these:[quote]–with-python-incdir=/opt/local/Library/Frameworks/Python.framework/Headers --with-python-libdir=/opt/local/Library/Frameworks/Python.framework[/quote]
should be removed, or point to p2.5 (IIRC, it’s picked up by itself, if you don’t specify any options).
Further, the ‘python’ command should of course be p2.5, and the set of DYLD_LIBRARY_PATH, LD_LIBRARY_PATH, and PYTHONPATH may not point to any of the other (older) python shared libs.
Do all these variables check out?
Thanks for your continued help.
I did check to make sure python launches the correct version and it does. I removed the flags and recompiled. The ./configure works, but now the ‘make’ doesn’t work. The error message:
*** No rule to make target
/Library/Frameworks/Python.framework/Versions/Current/include/python2.4/Python.h', needed bypyroot/src/Adapters.o’. Stop.
Of course that directory doesn’t exist anymore because python2.5 folder has supplanted it.
./configure options I have tried.
- ./configure --enable-python --with-python-incdir=/Library/Frameworks/Python.framework/Versions/2.5/include --with-python-libdir=/Library/Frameworks/Python.framework/Versions/2.5/lib
- ./configure --enable-python
- ./configure --enable-python --prefix=$ROOTSYS --etcdir=$ROOTSYS/etc --libdir=$ROOTSYS/lib --incdir=$ROOTSYS/include
If I explicitly include the python-incdir and python-libdir directories I don’t get the ‘no rule to make target’ message; I get the old ’ Interpreter not initialized (version mismatch?)’ problem.
my current profile:
strange that the normal way doesn’t work. Does “Current” under “Versions” point to 2.5? The configure script tries this base path “/Library/Frameworks/Python.framework/Versions/Current” and tries the “/System/…” after that.
As for the options, this one:
[quote]–with-python-libdir=/Library/Frameworks/Python.framework/Versions/2.5/lib[/quote]should likely be this (drop the ‘lib’): --with-python-libdir=/Library/Frameworks/Python.framework/Versions/2.5/
That is, it should point to the location of “Python” (note cap), which is an archive containing the loadable shared library. (IIRC)
I tried two ./configure options,
- ./configure --enable-python
- ./configure --enable-python --with-python-libdir=/Library/Frameworks/Python.framework/Versions/2.5/ --with-python-incdir=/Library/Frameworks/Python.framework/Versions/2.5/include
With the modified flags, both options give the same problem. Everything halts during the ‘make’ with the error message written in my previous post.
I double checked and Current points to the new version.
drwxr-xr-x 11 root admin 374B Dec 18 2006 2.4/
drwxrwxr-x 10 root admin 340B Apr 18 16:11 2.5/
lrwxr-xr-x 1 root admin 3B Sep 17 18:22 Current@ -> 2.5
I’m stumped! Should I retry everything with clean source?
so, does this file “/Library/Frameworks/Python.framework/Versions/2.5/Python” exist?
The file exists, although it has a different date associated with it, which is odd. The contents of the directory.
lrwxr-xr-x 1 root admin 17B Sep 17 18:22 Headers@ -> include/python2.5
drwxrwxr-x 3 root admin 102B Apr 18 16:11 Mac/
-r-xrwxr-x 1 root admin 7M Apr 18 16:10 Python*
drwxrwxr-x 6 root admin 204B Sep 17 18:23 Resources/
drwxrwxr-x 14 root admin 476B Apr 18 16:11 bin/
drwxrwxr-x 3 root admin 102B Apr 18 16:11 include/
drwxrwxr-x 19 root admin 646B Apr 18 16:11 lib/
drwxrwxr-x 3 root admin 102B Apr 18 16:10 man/
Things now work and I have no idea why. I started with a fresh ftp downloaded of the source from root.cern.ch, recompiled using the exact same flags, and viola–‘import root’ works.
For the benefit of others reading this post, all I had to do was.
- checkout new source
- install version 2.5 of python available as a universal binary from python.org
- ./configure --enable-python (+ some other things I wanted like minuit2, roofit, etc. )