PyROOT in Spyder

Hi,

I am a Mac user (EI Capitan), trying to run PyRoot in Spyder:
github.com/spyder-ide/spyder/releases

I installed root 6, python 2.7.10, and the corresponding spyder release;
I could open root in my terminal, and open python, import ROOT:

[code]Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT[/code]
It works fine.

However, if I try to run this under Spyder:

>>> import ROOT Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/renormalization/root/lib/ROOT.py", line 24, in <module> import cppyy File "/Users/renormalization/root/lib/cppyy.py", line 60, in <module> import libPyROOT as _backend ImportError: dlopen(/Users/renormalization/root/lib/libPyROOT.so, 2): Library not loaded: @rpath/libCore.so Referenced from: /Users/renormalization/root/lib/libPyROOT.so Reason: image not found

Previously, I get the instruction to specify the LD_LIBRARY_PATH; however, if I run this code:

import os, sys sys.path.append('/Users/renormalization/root/') os.environ['ROOTSYS'] = '/Users/renormalization/root' os.environ['LD_LIBRARY_PATH'] = os.path.join(os.environ['ROOTSYS'], 'lib') + os.pathsep + os.environ['LD_LIBRARY_PATH'] os.execv(sys.executable, sys.argv) import ROOT

Then I get this output:

>>> runfile('/Users/renormalization/.spyder2/temp.py', wdir='/Users/renormalization/.spyder2') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile execfile(filename, namespace) File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile builtins.execfile(filename, *where) File "/Users/renormalization/.spyder2/temp.py", line 11, in <module> os.environ['LD_LIBRARY_PATH'] = os.path.join(os.environ['ROOTSYS'], 'lib') + os.pathsep + os.environ['LD_LIBRARY_PATH'] File "UserDict.pyc", line 23, in __getitem__ KeyError: 'LD_LIBRARY_PATH'

Could you help me with this? Much appreciated!

Best Regards,
Tony

[url]PyROOT issues on OS X 10.11 (El Capitan)

Apple SIP removes envars such as LD_LIBRARY_PATH for system python.

-Dom

Hi Dom,

what exactly should I do in this case? I am still very confused…

I changed:

now the error is:

>>> runfile('/Users/renormalization/.spyder2/temp.py', wdir='/Users/renormalization/.spyder2') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile execfile(filename, namespace) File "/Applications/Spyder-Py2.app/Contents/Resources/lib/python2.7/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile builtins.execfile(filename, *where) File "/Users/renormalization/.spyder2/temp.py", line 17, in <module> import ROOT File "/Users/renormalization/root/lib/ROOT.py", line 24, in <module> import cppyy File "/Users/renormalization/root/lib/cppyy.py", line 60, in <module> import libPyROOT as _backend ImportError: dlopen(/Users/renormalization/root/lib/libPyROOT.so, 2): Library not loaded: @rpath/libCore.so Referenced from: /Users/renormalization/root/lib/libPyROOT.so Reason: image not found

Best,
Tony

[quote=“Dominique”][url]PyROOT issues on OS X 10.11 (El Capitan)

Apple SIP removes envars such as LD_LIBRARY_PATH for system python.

-Dom[/quote]

Per the link: rebuild with cmake and -Drpath=ON, or install non-system python. No ldpath manips with system python, so the latter is your option. Or disable SIP.

-Dom

Anyone, I have already installed root but whenever I tried to import it on spyder it says module not found. its not working even in python3 in terminal.