Libcppyy3_8 in Python3.8 on lxplus7


ROOT Version: 6.24/06
Platform: lxplus7
Compiler: Python 3.8.12


Hello, I’m using lxplus7 virtual machine and tried to import ROOT inside python environment as follows:

[mgiza@lxplus717 scripts]$ python
Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.06/x86_64-centos7-gcc48-opt/lib/cppyy/__init__.py", line 60, in <module>
    importlib.import_module(libcppyy_mod_name)
  File "/cvmfs/lhcb.cern.ch/lib/var/lib/LbEnv/2252/stable/linux-64/lib/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 "/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.06/x86_64-centos7-gcc48-opt/lib/ROOT/__init__.py", line 22, in <module>
    import cppyy
  File "/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.06/x86_64-centos7-gcc48-opt/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

The “import ROOT” is a part of my script that I want to run in ROOT 6.24 due to several dependencies on other associated packages.

Running “root-config --features” gives me:

cxx11 asimage builtin_afterimage builtin_clang builtin_cling builtin_davix builtin_ftgl builtin_gl2ps builtin_glew builtin_llvm builtin_lz4 builtin_lzma builtin_nlohmannjson builtin_openui5 builtin_pcre builtin_tbb builtin_unuran builtin_vdt builtin_veccore builtin_xrootd builtin_xxhash builtin_zlib clad dataframe davix exceptions fftw3 fitsio fortran gdml http imt mathmore mlp minuit2 mysql opengl pgsql pyroot roofit runtime_cxxmodules shadowpw shared soversion sqlite ssl tmva tmva-cpu tmva-pymva spectrum unuran vmc vdt veccore x11 xml xrootd

Moreover I checked:

[mgiza@lxplus717 scripts]$ root-config --has-python
no

Now, I would like to ask what is the correct way to deal with this problem on lxplus7? Should I rebuild ROOT in one of my directories?

For:

[mgiza@lxplus775 scripts]$ root-config --has-pyroot
yes
[mgiza@lxplus775 scripts]$  root-config --python3-version
3.6.8
[mgiza@lxplus775 scripts]$ python3.6

I’m sourcing the ROOT 6.24/6 via:

source /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.06/x86_64-centos7-gcc48-opt/bin/thisroot.sh

The error persists nevertheless

1 Like

In your first post, you seem to be mixing python coming from conda with ROOT coming from lcg. I don’t think this will work. You need to use python provided by the operating system (same for the compiler and all libraries).