Opened 12 years ago

Closed 12 years ago

#37673 closed defect (fixed)

root @5.34.04 +python27 pyROOT doesn't work

Reported by: jd.mansour@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc: mattiafrancescomoro@…, cjones051073 (Chris Jones)
Port: root

Description

If I install root with +python27, it is supposed to install pyROOT support. However, I get the following error message when I import ROOT from python:

$ python2.7 -c "import ROOT"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ROOT.py", line 85, in <module>
    import libPyROOT as _root
ImportError: No module named libPyROOT

This is because libPyROOT.so (which is fine) is not found. One solution is to put it on the PYTHONPATH, but a cleaner solution would be to make the port create a link to it somewhere on sys.path, for example:

$ sudo ln -s /opt/local/lib/root/libPyROOT.so /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7

After creating the link, the ROOT python module works as expected.

Change History (4)

comment:1 Changed 12 years ago by jmroot (Joshua Root)

Cc: mattiafrancescomoro@… jonesc@… added

Please remember to Cc the maintainers.

comment:2 Changed 12 years ago by cjones051073 (Chris Jones)

Thanks for the report. I use PyRoot myself a lot and it works for me, but then I have

# ROOT
export ROOTSYS=/opt/local
if [ -n "${PYTHONPATH+x}" ]; then
 export PYTHONPATH=${ROOTSYS}"/lib/root:"${PYTHONPATH}
else
 export PYTHONPATH=${ROOTSYS}"/lib/root"
fi

in my ~/.profle ... ;)

You point is well taken though. I'll see if I can come up with something that works without needing this...

Chris

Last edited 12 years ago by cjones051073 (Chris Jones) (previous) (diff)

comment:3 Changed 12 years ago by cjones051073 (Chris Jones)

I have just submitted ticket #37687 which contains a patch to fix this.

cheers Chris

comment:4 Changed 12 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.