pyROOT in Eclipse IDE on OS X

Hi,

I am trying to get pyROOT (from ROOT 5.22) working form within the Eclipse IDE (3.2) on OS X (10.5.6). I have set up the interpreter and have configured the environment settings within the Eclipse project to have the following:

ROOTSYS=/Users/gcowan/software/root
PATH=$ROOTSYS/bin:$PATH
LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
DYLD_LIBRARY_PATH=$ROOTSYS/lib:$DYLD_LIBRARY_PATH

However, when I try to run a macro I get the error:

import ROOT
File “/Users/gcowan/software/root/lib/ROOT.py”, line 86, in
import libPyROOT as _root
ImportError: dlopen(/Users/gcowan/software/root/lib/libPyROOT.so, 2): Library not loaded: @rpath/libCore.so
Referenced from: /Users/gcowan/software/root/lib/libPyROOT.so
Reason: image not found

I’ve seen a couple of other postings on this forum about this issue, but none of them have helped me. Does anyone have any ideas?

Cheers,
Greig

Greig,

presumably you have set PYTHONPATH as well? Does “import ROOT” work from python from a Terminal?

Cheers,
Wim

Hi Wim,

In my .bashrc I have all of the relevant variables set (PATH, PYTHONPATH…) and I can import ROOT at the python prompt.

Eclipse also has it’s own PYTHONPATH and environment settings (for the system as a whole and for each project, I think) and as far as I can tell I have set them correctly. If I purposefully don’t add ROOTSYS to the Eclipse system PYTHONPATH then the error message I get is:

import ROOT

ImportError: No module named ROOT

which is what I would expect with this configuration. Comparing this with the error message that I had in my first post shows that eclipse knows enough about ROOT to start loading the module but subsequently fails.

Cheers,
Greig

Creig,

[sorry for asking probably more obvious stuff, but I only have an ancient little Mac at my disposal, so hard to try and reproduce the issue]

Could you run from within Eclipse a small script that prints the environment variables as seen by the python process run from Eclipse? Something like:import os print 'ldpath:', os.environ[ 'LD_LIBRARY_PATH' ] print 'dyldpath:', os.environ[ 'DYLD_LIBRARY_PATH' ]
Cheers,
Wim

Hi Wim,

Problem solved.

In the Eclipse python interpreter environment I had set the ROOTSYS environment variable. I had also set PATH, LD_LIBRARY_PATH, … to:

PATH=$ROOTSYS/bin:$PATH

etc

I thought that $ROOTSYS would be picked up from my definition in Eclipse. Howevr, if I instead replace $ROOTSYS with the absolute path to my ROOT installation then everything works.

Sorry for the noise!

Cheers,
Greig