Support for multiple versions of python?

For CMS, I’m trying to build our python stack with python2.7 and python3.6 support (eventually to remove the python2.7…) - From this forum I see work in progress for ROOT supporting multiple python versions (which I guess is a matter of rebuilding one library?), but I haven’t found anything indicating that this work completed.

Does anyone have a recipe I can follow?


Hi David,

I’m afraid that is not possible yet, ROOT still needs to be built either with Python2 or Python3.



To rebuild, you probably indeed have no other option than a full rebuild. It used to be possible with the autoconf scripts to simply make clean-pyroot, reconfigure, rebuild only, but the cmake scripts regressed AFAICT. Also, it’s no longer just PyROOT, but also PyVMA.

That said, since your p3 is new enough, you can have the two live side-by-side as long as you don’t care about using TPython from root.exe.

What you do is: build first for p3, then move to an ABI tagged named. You can find this tag by using:

$ python -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))'

It will be ‘None’ for p2.7, but something like “” for p3.6, so then rename:

$ mv

And same for libPyMVA if you want it. Now save the file(s) somewhere out of the build tree, wipe the build, then start over building for p2. Once fully installed, move that saved ABI tagged p3 file next to from p2 in $ROOTSYS/lib and you should be in business.

Thanks! - I found also a fedora recipe in this forum that doing something similar. but your answer also explains the idea behind

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