Remake ROOT with Python3

Hi ROOT forum,
I am currently running ROOT with Python2 and all is working well. Ideally, I wish to enable ROOT to run with both Python2 and Python3. Alternatively, I would like to run it with Python3 instead of Python2.
Is the former possible? If so, how can I enable both Python versions? If not, how can I change my ROOT to run with Python3 without changing anything/causing any damage (I have MadGraph and Pythia configured with my current ROOT and hopefully this change could be made without affecting either of them). I’ve already read https://sft.its.cern.ch/jira/browse/ROOT-8260 but unfortunately did not get an exact answer.
Your help would be highly appreciated.


Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.18.04
_Platform: Linux
_Compiler: g++


Your a bit old version of ROOT supports one version of python only (specified at build time, so you need to have separate ROOT binary distributions if you want different python versions).

Newest ROOT versions have partial support for two python versions simultaneously:

Hi, thanks for the quick reply.
May I keep the same ROOT version and change it to run with Python3 only? If so, how should this be done with minimal changes?

The best would be to rebuild it from scratch (note that you can have two completely separated binary distributions in two separate directories and then use their “thisroot.sh” scripts to switch between them at run time).

Would that affect Pythia/MadGraph dependencies on ROOT?

If any parts of Pythia/MadGraph depend on some particular python version then you’re out of luck.

I see. So amongst the options I think the best would be the one you suggested, namely creating another root binary and in it building a root intended only for Python3 which can be sourced as needed. This shouldn’t make any changes, correct? Also, which ROOT version would I then need and could you kindly refer me to its installation guide?

What’s your OS?

Linux Ubuntu Mint

If it’s the one with gcc 9.3.0 then you should be able to use the ROOT Team provided binary distribution for Ubuntu 20, which you just need to download and unpack (as of today, ROOT 6.22/08 is the newest one with a built-in full python 3.8.5 and partial python 2.7.18 support):
https://root.cern/download/?C=M;O=A;P=*[uU][bB][uU][nN][tT][uU]*20*

In near future, there should appear ROOT 6.24/00.

Install instructions (including the building from source): Installing ROOT - ROOT

Hi @Wile_E_Coyote thanks so much and sorry for the late reply! Your advice worked — I’ve installed another version of ROOT which I can source at will in order to use it in conjunction with Python 3. Cheers.

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