I am trying the last few days to do import the ROOT (PyROOT) lib in Python3.X and I could not find any solution on the Internet. I was trying to use both in ipython and PyCharm as well, without success, unfortunately. The error that I saw was “ImportError: No module named ROOT” or. Is there anyone in the group that he tried to it give any hint or direction or even better a guide to install it? I use Ubuntu 18.04 and the ROOT version that I have is 6.12. I hope that I did not forget anything.
Welcome to the forum!
I also had very hard times to install
python3, I hope I can give you some hints…
First of all it would be helpful to understand how did you install
- use package manager (apt-get) or pre-compiled binary package from the website
- installed (compiled)
rootyourself using source files?
In the 1st case pyROOT is installed with your system default python which is probably
python2.7 you can check that executing
python2 >>> import ROOT >>>
which should work.
The solution to install pyROOT with new python3 which worked for me:
- Install python3 compiling source files with
- Install root compiling source files providing flag to the location of
if I remember correcly.
Also take note, at the Building ROOT from source - ROOT for pyROOT. It says that since v6.22 it is possible to do for two python versions simultaneously. So maybe it is easier if you use more recent versions of ROOT than 6.12
Maybe installing python3 from source is not necessary, you can try it out with your python3, but if it will complain that it needs “shared libraries”, then you need to compile python3 yourself as well…
I hope it helps,
I’d recommend you install ROOT using conda, it’s probably the easiest option:
PS: Thank you @FoxWise for your post!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.