I’ve built myself a pyROOT experimental 6.20.06 ROOT mainly in order to be able to use ROOT with python2 and python3 (as I understand, it is not possible with standard pyROOT). There are however 2 problems:
You need to specify explicitly a cmake flag for pyroot experimental to be built, unlike stated in the release notes
Then it doesn’t work here… After import ROOT:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/root/lib/ROOT.py", line 24, in <module>
import cppyy
File "/opt/root/lib/cppyy.py", line 61, in <module>
import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
The error you get indicate that you are using the old PyROOT (possibly from another installation). This is likely caused by adding source thisroot.sh somewhere in your bashrc, or by having another ROOT installed somewhere that comes first in your $PATH. On Fedora you can easily use ROOT with both Python 2.x and 3.x, just remove your local installations and do yum install root python2-root python3-root. That will give you ROOT 6.20.06 and both PyROOT for Python 2 and 3. More components can be installed on demand, see https://koji.fedoraproject.org/koji/buildinfo?buildID=1523704 for more details.
Edit: I realize now that only Fedora 30 and below offer this possibility, Matthias stopped building the Python 2.x package for ROOT in Fedora 31, which you use…
Thanks. So, source thisroot.sh in bashrc is a wrong approach in general? Usually I don’t call it, I just set ROOTSYS directory and everything I need works, but here I wanted to try different ROOT versions and this requires sourcing thisroot.sh.
About the Fedora binaries, this is a nice solution, but every now and then I need to test some bugfix from the master. Moreover, for example at the moment the last binary in the repository is 6.20.04 which contains some ugly bugs that make my ROOT software unusable (fine on 6.20.06).
in the shell where you want to use ROOT, not on your .bashrc. That way you make sure not to mix up different versions of ROOT.
If you need to compile against a specific version of ROOT, use cmake -DCMAKE_PREFIX_PATH=/opt/root/<version> -DCMAKE_C_COMPILER=$(root-config --cc) -DCMAKE_CXX_COMPILER=$(root-config --cxx) ... when configuring your own project.
Thank you. I’ve managed to build master and now I am able to change root versions simply with the ROOT_PYTHON_VERSION variable and then sourcing thisroot.sh
However, now a question: does it work only for pyroot experimental, or also for the standard one?
It seems that pyroot experimental can’t even run the gui_ex.py in the tutorials, not mentioning my software.
python -i doesn’t fix, the error message is the same. Perhaps I should start a separate thread, but here we go:
$ python -i gui_ex.py
Traceback (most recent call last):
File "gui_ex.py", line 35, in <module>
m = ROOT.TPyDispatcher( MyDraw )
File "/opt/root_master/lib/ROOT/_facade.py", line 163, in _fallback_getattr
raise AttributeError("Failed to get attribute {} from ROOT".format(name))
AttributeError: Failed to get attribute TPyDispatcher from ROOT
Then with my own software which I run as an executable script, errors are different and not sure if related. They start like this:
input_line_46:9:43: error: base class '::TGMainFrame' has private copy constructor
Dispatcher1(const Dispatcher1& other) : TGMainFrame(other), m_self(oth...
^
/home/lewhoo/opt/root_master/include/TGFrame.h:487:4: note: declared private here
TGMainFrame(const TGMainFrame&); // not implemented
^
/home/lewhoo/workspace/etos/etoswindows/worldmapwindow.py:11: RuntimeWarning: no python-side overrides supported