Problem Importing ROOT into python on Tiger

Hi,

We are trying to set up ROOT v5.20.00 on Mac tiger. We have successfully set up this version from source for use on RHEL4 and on windows, include pyRoot, built against python 2.5.1. We are trying to do the same on the Mac but have run into trouble. The ROOT build seems to have been successful, but when I go to import ROOT into python, it fails:
Python 2.5.1 (r251:54863, Mar 20 2009, 21:12:56)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Fatal Python error: Interpreter not initialized

I’ve tried this in verbose mode and I see:
bldmac01:users/glground/heather] heather% python -v

installing zipimport hook

import zipimport # builtin

installed zipimport hook

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/site.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/site.py

import site # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/site.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/os.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/os.py

import os # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/os.pyc
import posix # builtin

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/posixpath.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/posixpath.py

import posixpath # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/posixpath.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/stat.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/stat.py

import stat # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/stat.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/UserDict.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/UserDict.py

import UserDict # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/UserDict.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/copy_reg.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/copy_reg.py

import copy_reg # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/copy_reg.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/types.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/types.py

import types # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit//python/2.5.1-gl2/gcc40/lib/python2.5/types.pyc
import _types # builtin

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/warnings.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/warnings.py

import warnings # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/warnings.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/linecache.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/linecache.py

import linecache # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/linecache.pyc
import encodings # directory /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/init.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/init.py

import encodings # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/init.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/codecs.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/codecs.py

import codecs # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/codecs.pyc
import _codecs # builtin

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/aliases.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/aliases.py

import encodings.aliases # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/aliases.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/ascii.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/ascii.py

import encodings.ascii # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/encodings/ascii.pyc
Python 2.5.1 (r251:54863, Mar 20 2009, 21:12:56)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT

/nfs/slac/g/glast/users/glground/heather/tiger-i386-32bit/ROOT/v5.20.00-gl1/gcc40/lib/ROOT.pyc matches /nfs/slac/g/glast/users/glground/heather/tiger-i386-32bit/ROOT/v5.20.00-gl1/gcc40/lib/ROOT.py

import ROOT # precompiled from /nfs/slac/g/glast/users/glground/heather/tiger-i386-32bit/ROOT/v5.20.00-gl1/gcc40/lib/ROOT.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/future.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/future.py

import future # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/future.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/string.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/string.py

import string # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/string.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/re.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/re.py

import re # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/re.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_compile.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_compile.py

import sre_compile # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_compile.pyc
import _sre # builtin

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_constants.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_constants.py

import sre_constants # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_constants.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_parse.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_parse.py

import sre_parse # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/sre_parse.pyc

/afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/rlcompleter.pyc matches /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/rlcompleter.py

import rlcompleter # precompiled from /afs/slac/g/glast/ground/GLAST_EXT/tiger-i386-32bit/python/2.5.1-gl2/gcc40/lib/python2.5/rlcompleter.pyc
dlopen(“/nfs/slac/g/glast/users/glground/heather/tiger-i386-32bit/ROOT/v5.20.00-gl1/gcc40/lib/libPyROOT.so”, 2);
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort

From what I can see, I am picking up the right version of python - we are using our own python, not the system installed version - though it is a fairly vanilla installation. I’ll admit to not being 100% comfortable on the Mac yet - but I do have LD_LIBRARY_PATH, PYTHONPATH, as well as DYLD_LIBRARY_PATH set (though I did not explicitly set DYLD_LIBRARY_PATH before building ROOT).

Thanks for any suggestions,
Heather

Heather,

is a Mac linker issue (it has two namespaces, leading to two python interpreters: the one you start by typing “python” and the one that is linked in, and doesn’t get initialize). Please see these topics:
http://root.cern.ch/phpBB2/viewtopic.php?t=5612
http://root.cern.ch/phpBB2/viewtopic.php?t=5709

Cheers,
Wim