ModuleNotFoundError: No module named 'ROOT._pythonization._tmva._batchgenerator'

Hello ROOT experts,
I’m having some problems when importing Root on Python. I have built Root on lxplus to match with the Python version of the environment that I’m using. Therefor there is not a problem with compatibility.

root-config --python-version
3.10.4

However when opening the Python compiler and giving the command import ROOT, it’s giving me this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/afs/cern.ch/work/m/mzabloud/root/root_install/lib/ROOT/__init__.py", line 39, in <module>
    _register_pythonizations()
  File "/afs/cern.ch/work/m/mzabloud/root/root_install/lib/ROOT/_pythonization/__init__.py", line 302, in _register_pythonizations
    importlib.import_module(__name__ + '.' + module_name)
  File "/cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.0/spack-0.20.0-gcc-12.1.0/spack-0.20.0/opt/spack/linux-almalinux9-x86_64/gcc-12.1.0/python-3.10.4-avttyjcqg3mct6r252fx5mxmff5ddf6z/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/afs/cern.ch/work/m/mzabloud/root/root_install/lib/ROOT/_pythonization/_tmva/__init__.py", line 27, in <module>
    from ._batchgenerator import (
ModuleNotFoundError: No module named 'ROOT._pythonization._tmva._batchgenerator'

_ROOT Version: 6.32.02
_Platform: lxplus alma9
_Compiler: -

Thank you in advance for your advice.
Have a nice day.

Hi Michaela,

Thanks for the post and welcome to the ROOT Community!

I am sorry to read you have to overcome these technical hurdles due to Python versions of your stack and lxplus.

Are you sure you configured ROOT with all necessary options ("-D"s)? Could you paste here the summary of the cmake invocation in your build directory (“cmake .”)?

@moneta

Cheers,
Danilo

PS
In case you want to compile on lxplus, which can be a painful exercise, you can always do it from the /tmp/ directory, to avoid to use afs which is a good product, but not adequate for compilation (slow).

Hi Danilo,
since I don’t have R installed and Roofit was giving me issues, I used this configuration:

cmake -DCMAKE_INSTALL_PREFIX=../root_install -Ddataframe=OFF -Droofit=OFF ../root_src

Cheers,
Michaela

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