PyROOT libraries not found despite being present

Asked by Terry Pilkington

System setup:
MacOSX 10.6.8
Python 2.7.5 :: Anaconda 1.6.1 (x86_64)
Root 5.34/10 (29 August 2013) --- the binary release
MA5 1.1.8 (2013/09/12)

I'm feeling rather dumb, as I'm not sure what's missing. When I try to start MA5, I get the following error:

Checking mandatory packages:
     - python [OK]
     - python library: numpy [OK]
     - g++ [OK]
     - Root [OK]
     - PyRoot libraries [FAILURE]
 ** ERROR: 'root-config --libdir' indicates a wrong path for ROOT libraries. Please specify the ROOT library path into the environnement variable $PYTHONPATH

When I go through the root-config options, I see:

terryp$ root-config --version
      5.34/10
terryp$ root-config --has-python
      yes
terryp$ root-config --libdir
      /Users/terryp/work/root/lib
terryp$ echo $PYTHONPATH
      :/Users/terryp/anaconda/bin:/Users/terryp/anaconda/lib:/Users/terryp/work/root/lib

My root/lib folder contains what seem to be the right libraries:
libPyROOT.rootmap
libPyROOT.so
ROOT.py
ROOT.pyc
ROOT.pyo

So, as I said, I'm not sure what's missing from where.

Thanks in advance,
Terry

Question information

Language:
English Edit question
Status:
Solved
For:
MadAnalysis 5 Edit question
Assignee:
Eric Conte Edit question
Solved by:
Terry Pilkington
Solved:
Last query:
Last reply:
Revision history for this message
Eric Conte (eric-conte) said :
#1

Dear Terry,

Effectively, this error message is not very clear. To clarify, MadAnalysis 5 manages to find the PyROOT library but an issue seems to appear where this library is loaded by Python. Nonetheless MadAnalysis 5 does not give any more information about this issue.

If you agree, could you reproduce this error outside MadAnalysis 5 ? To this end, you have just to launch Python by typing 'python' at the shell prompt and then by typing in the Python console the 3 following command lines:

import sys
sys.path.append('/Users/terryp/work/root/lib')
from ROOT import gROOT

If I am right, the last line must fail and a more detailed error message will be displayed.
Could you send us this error message ? It will help us in order to fix the problem.

Thanks in advance,
Cheers,
Eric

Revision history for this message
Terry Pilkington (tpilking) said :
#2

>>> from ROOT import gROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/terryp/work/root/lib/ROOT.py", line 103, in <module>
    import libPyROOT as _root
ImportError: dlopen(/Users/terryp/work/root/lib/libPyROOT.so, 2): Library not loaded: /afs/cern.ch/sw/lcg/external/Python/2.7.3/x86_64-mac106-gcc42-opt/lib/libpython2.7.dylib
  Referenced from: /Users/terryp/work/root/lib/libPyROOT.so
  Reason: image not found

So it would appear that using the binary version of ROOT is the problem? That's frustrating, since I have yet to be able to successfully compile ROOT from source on my machine.

Revision history for this message
Eric Conte (eric-conte) said :
#3

Dear Terry,

The good point is that the file ROOT.py is found by Python. I am not an expert in Mac OS but it seems the linker does not manage to fin the file libPyROOT.so when ROOT.py is loaded.

Could you set the lib path (=/Users/terryp/work/root/lib) to the following environment variables :
LD_LIBRARY_PATH
DYLD_LIBRARY_PATH

Perhaps these settings could fix the problem ...
Cheers,
Eric

Revision history for this message
Terry Pilkington (tpilking) said :
#4

Hi Eric,
 The .../root/lib path was already set for those two variables. After scouring the ROOT forums, I managed to figure out that I needed to add the python libraries to the LD and DYLD paths:
/System/Library/Frameworks/Python.framework/Versions/Current for the standard MacOSX python and
/Users/terryp/anaconda/lib for the Anaconda (SciPY) installation.

However, when I added those, I got the following error:

     - PyRoot libraries Message: (file "/Users/terryp/work/root/lib/libGX11TTF.so", line -1) dlopen error: dlopen(/Users/terryp/work/root/lib/libGX11TTF.so, 9): Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /Users/terryp/anaconda/lib/libJPEG.dylib
 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Error in <TCint::AutoLoad>: failure loading library libGX11TTF.so for class TGX11TTF

And similarly for libPNG.dylib. Apparently, this traces back to how OSX searches for things. The system finds the libJPEG.dylib in .../anaconda/lib and stops looking, but for some reason it's the wrong one. The solution I've come up with is to move all the libJPEG... and libPNG... files out of .../anaconda/lib, but I'm not sure what (if anything) that will break for other programs in the future.

Thanks for the help,
Terry