ROOT Version: 6.10/04
OS: Linux Mint Tricia (based on Ubuntu 18.04)
Compiler: gcc(and g++) 7.5.0
Python2 version: Python 2.7.17
Python3 version: Python 3.6.9
I’m a user of ROOT and recently I started doing a course based on JupyterNotebooks and Root.
I’m currently not able to import ROOT inside a Jupyter Notebook. This is the message I receive after running “import ROOT”:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-ee8dc4376aa8> in <module>
----> 1 import ROOT
~/HEPSoftwares/ROOT/root-build/lib/ROOT.py in <module>
22 ### system and interpreter setup ------------------------------------------------
23 import os, sys, types
---> 24 import cppyy
25
26
~/HEPSoftwares/ROOT/root-build/lib/cppyy.py in <module>
59 sys.setdlopenflags( 0x100 | 0x2 ) # RTLD_GLOBAL | RTLD_NOW
60
---> 61 import libPyROOT as _backend
62
63 # reset dl flags if needed
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
I’ve made some tests and discovered that I can import ROOT in Python2 terminal but the same it’s not true for a Python3 terminal:
Python2:
ecaue@TARDIS:~$ python2
Python 2.7.17 (default, Feb 27 2021, 15:10:58)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>
Python3:
ecaue@TARDIS:~$ python3
Python 3.6.9 (default, Dec 8 2021, 21:08:43)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ecaue/HEPSoftwares/ROOT/root-build/lib/ROOT.py", line 24, in <module>
import cppyy
File "/home/ecaue/HEPSoftwares/ROOT/root-build/lib/cppyy.py", line 61, in <module>
import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
>>>
I’m using an old ROOT distribution because I got some issues installing the recent ones. It is installed inside the dir located in
/home/ecaue/HEPSoftwares/ROOT/root-build
Jupyter was installed using “pip3 install jupyter”.
This is how my environment variables are defined in my .bashrc file:
source /home/ecaue/HEPSoftwares/ROOT/root-build/bin/thisroot.sh
export ROOTSYS=/home/ecaue/HEPSoftwares/ROOT/root-build
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib/:$LD_LIBRARY_PATH
I really appreciate if someone can help me find out how to force PyRoot to run in Jupyter since I installed it using python3.