Getting ROOT to work with Python3

Hi there,

I have had continual trouble getting ROOT to work with Python3. This was an outstanding issue but I have recently updated to version 6.22/0.8 on Ubuntu 18.04, which I understand has the ability to build the PyROOT bindings for python2 and python3. I downloaded the binary Release 62208 - ROOT for Ubuntu 18. However I get an ImportError in Python3 (version 3.7.4) and when I check the field root-config --python3-version nothing is returned which implies to me that the Python3 bindings aren’t built? When I do root-config -python2-version , 2.7.17 is returned.

Interestingly, when I do export PYTHONPATH=/usr/lib64/root in my base (home) directory, I can import ROOT in python3. This does not work when working in any other directory…

Many thanks,

Try: ROOT 6.24/02

Thanks, this works although ROOT then uses python3.6.9 rather than python3.7.5 - both are installed in /usr/bin. Is there any way I can point ROOT to python3.7 instead?

If you want to use another python version, you need to compile ROOT yourself.

BTW. On Ubuntu 18.04, if you want to build ROOT with python2 AND python3 support, you need to install some “recent” CMake version (you do not need it for a single python2 OR python3 version).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.