https://sft.its.cern.ch/jira/browse/ROOT-4627
I want to install an old version of ROOT (5.34.21) and import it from python.
I know it’s not mantained anymore but the software I have to use for my work is built on this old root version.
It is suggested (in the forum entries I posted) that in order to obtain compatibility with python 3 it is better to use the cmake installation instead of the old ./configure + make combination.
I am following all the suggestion I could find but still I cannot import ROOT from python.
The python I want to use is taken form a miniconda3 installation (I don’t have sudo on this mahcine).
I am configuring cmake with the following options
giving explicitly not only the -Dpython3=ON and the executable (-DPYTHON_EXECUTABLE) but also the include and lib folders (-DPYTHON_INCLUDE_DIR, -DPYTHON_LIBRARY).
The compilation run smooth, but at the end, checking in the lib folder of the build directory
[tribble11] ~ % ls $SOFT/root_v5.34.21/root_build/lib/ROOT.py
ls: cannot access /afs/ifh.de/group/amanda/scratch/cosimo/software/root_v5.34.21/root_build/lib/ROOT.py: No such file or directory
the ROOT.py file that should be imported by python is not produced (in my poor understanding is that the file that makes the trick since it is suggested to append $ROOTSYS/lib to $PYTHONPATH).
I don’t understand where is the problem. Do these old versions foresee at all a compatibility with the latest python (5.34.21 dates back to September 2014 Release 53421 - ROOT, so it is not so “old”).
Any help will be really valuable, thanks a lot in advance!
Cosimo
ROOT Version (5.34.21):
Platform, compiler (Scientific Linux release 6.9 (Carbon), g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18))
basically nothing in the configuration is changed wrt the previous post, just I am removing -Dpython3=ON and replacing with -Dpython=ON, looks like -Dpython3=ONhttps://sft.its.cern.ch/jira/browse/ROOT-9033 was never used.
The main point is that upgrading to a higher version of ROOT (5.34.21 -> 5.34.36) it is possible to obtain the correct creation of the files necessaries to import from python. Just check if ROOT.py is created in $ROOTSYS/lib and then append it to your $PYTHONPATH in your .bashrc.
export PYTHONPATH="$ROOTSYS/lib:$PYTHONPATH"
In my case I could use only those two versions of ROOT since my collaboration’s software relies on them.
All works fine to me. I hope that this can help other users trying to get compatibility with conda’s python.
Any clarification or feedback from the experts on this topic is welcome.
Thank you for reporting the solution to your issue. The fact that the ROOT.py is not copied to build in 5.34.21 but it is in 5.34.36, using the same build parameters, could be due to a bug in the build system that was fixed later.
What compiler did you use to build ROOT? Is it the conda compiler?
Ok, the reason I ask is that it seems the marriage conda - PyROOT can only work if ROOT is built with the same compiler that is shipped with conda, at least this is what was reported previously, e.g. :