Hello!
I installed ROOT from source exactly as indicated in ROOT install. It is installed in /usr/local/
inside the new folder root_install
.
I can successfully run ROOT in the terminal using root
and can work there.
I also installed python with Anaconda:
$ python --version
Python 3.7.6
The problem is the following: I can import the ROOT
package in Python in terminal
$ python
Python 3.7.6 (default, Jan 8 2020, 13:42:34)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>
and also in any text editor (Sublime Text 3 for example), but I cannot import ROOT
in Jupyter Notebook:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-ee8dc4376aa8> in <module>
----> 1 import ROOT
/usr/local/root_install/lib/ROOT/__init__.py in <module>
89 ip = get_ipython()
90 if hasattr(ip,"kernel"):
---> 91 import JupyROOT
92 import JsMVA
93
/usr/local/root_install/lib/ROOT/_facade.py in _importhook(name, *args, **kwds)
119 except Exception:
120 pass
--> 121 return _orig_ihook(name, *args, **kwds)
122 __builtin__.__import__ = _importhook
123
/usr/local/root_install/lib/JupyROOT/__init__.py in <module>
----> 1 from JupyROOT.helpers import cppcompleter, utils
2
3 if '__IPYTHON__' in __builtins__ and __IPYTHON__:
4 cppcompleter.load_ipython_extension(get_ipython())
5 utils.iPythonize()
/usr/local/root_install/lib/ROOT/_facade.py in _importhook(name, *args, **kwds)
119 except Exception:
120 pass
--> 121 return _orig_ihook(name, *args, **kwds)
122 __builtin__.__import__ = _importhook
123
/usr/local/root_install/lib/JupyROOT/helpers/cppcompleter.py in <module>
6 #-----------------------------------------------------------------------------
7
----> 8 from JupyROOT.helpers import utils
9 import ROOT
10
/usr/local/root_install/lib/ROOT/_facade.py in _importhook(name, *args, **kwds)
119 except Exception:
120 pass
--> 121 return _orig_ihook(name, *args, **kwds)
122 __builtin__.__import__ = _importhook
123
/usr/local/root_install/lib/JupyROOT/helpers/utils.py in <module>
25 import IPython.display
26 import ROOT
---> 27 from JupyROOT.helpers import handlers
28
29 # We want iPython to take over the graphics
/usr/local/root_install/lib/ROOT/_facade.py in _importhook(name, *args, **kwds)
119 except Exception:
120 pass
--> 121 return _orig_ihook(name, *args, **kwds)
122 __builtin__.__import__ = _importhook
123
/usr/local/root_install/lib/JupyROOT/helpers/handlers.py in <module>
24 major, minor = sys.version_info[0:2]
25 libjupyroot_mod_name = 'libJupyROOT{}_{}'.format(major, minor)
---> 26 _lib = importlib.import_module(libjupyroot_mod_name)
27
28
~/opt/anaconda3/lib/python3.7/importlib/__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
ImportError: dlopen(/usr/local/root_install/lib/libJupyROOT3_7.so, 2): Library not loaded: @rpath/Python3.framework/Versions/3.7/Python3
Referenced from: /usr/local/root_install/lib/libJupyROOT3_7.so
Reason: image not found
I also tried with root --notebook
and importing ROOT with the Python3 kernel, but the same error appears.
I tried for a solution following this answer (changing ldd
to otool -L
for MacOS, and chaging libPyROOT.so
to libJupyROOT3_7.so
, even though I don’t know if that makes sense):
$ otool -L libJupyROOT3_7.so | grep python
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: error: 'libJupyROOT3_7.so': No such file or directory
I have also searched for the file libJupyROOT3_7.so
inside /usr/local/root_install/lib/
and it is there.
5 days ago I tried installing ROOT with Homebrew but then I couldn’t even import ROOT succesfully in terminal with Python.
I am very new with all these things so if you can help me it would be very much appreciated.
Thank you very much.
ROOT Version: 6.22/01
Platform: MacOS Catalina 10.15.4
Compiler: Not Provided