I’m using a clean UBI8 image now, without any extra packages installed, i.e. I’m not running any dnf commands in my Dockerfile. The only root-related files are the ones I get from wget.
Also, I’m getting this error now when importing:
>>> import ROOT
Traceback (most recent call last):
File "/opt/app-root/src/root/root/lib/cppyy/__init__.py", line 60, in <module>
importlib.import_module(libcppyy_mod_name)
File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'libcppyy3_8'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/app-root/src/root/root/lib/ROOT/__init__.py", line 22, in <module>
import cppyy
File "/opt/app-root/src/root/root/lib/cppyy/__init__.py", line 62, in <module>
raise ImportError(
ImportError: Failed to import libcppyy3_8. Please check that ROOT has been built for Python 3.8
Which seems more descriptive.
I’ve also installed all dependencies listed here.
In summary:
Using a Dockerfile, I start from a Python3.8 UBI8 image, in which I install dependencies listed on the root installation page (dnf install -y make cmake gcc-c++ gcc binutils libX11-devel libXpm-devel libXft-devel libXext-devel python3-root)
I connect to the created container and I verify that which root does not find a root installation.
I then follow the procedure to:
wget the root_v6.26.08.Linux-centos8-x86_64-gcc8.5.tar.gz file from within the created container.
tar -xzfv it
source the thisroot.sh file in the extracted directory.
Verify that root --version returns ROOT Version: 6.26/08 and which rootandwhich root-config return the correct paths inside the extracted files.
root-config --python3-version still returns 3.6.8
In python3:
import ROOT
returns
ModuleNotFoundError: No module named 'libcppyy3_8'
@nothingface0 From the first post, your default Python version seems to be “Python 3.8.3”.
However, I have now found two different machines which run “CentOS Stream release 8” and “Rocky Linux release 8.6 (Green Obsidian)”, and both of them provide “Python 2.7.18” and “Python 3.6.8” (to my surprise, the same as on old CentOS 7 / RHEL 7).
To know for sure, you can search for libcppyy3_8.so in the ROOT installation directory. If it exists, I would try to import it alone import libcppyy3_8.
I don’t think we have pre-compiled binaries or LCG releases explicitly for RHEL, so I guess you can either try your luck with builds meant for CentOS or (probably safer) build from source as you did.
Hello! I tried using CentOS8 binaries which work for RHEL8, but, as you can see above, they are all compiled for Python 3.6, while I’m using Python 3.8, so I cannot run import ROOT.
Anyway, although tedious, building from source ended up solving the problem.