Use pyROOT + ROOT in Python Virtual Env on LXPLUS

Dear all,

I need to be able to use the XGBoost Python library on LXLPUS in conjunction with pyROOT. To do this I made a virtual environment and did ‘pip install xgboost dumpy SciPy pandas’ etc. These modules work fine. However I cannot “import ROOT” I get the error

ModuleNotFoundError: No module named 'ROOT'

However, when just typing “root” into the LXPLUS terminal ROOT starts fine. Upon entering “which root” I get “/usr/bin/root”. So ROOT is installed and recognised but import ROOT is not when using Python.

ROOT Version: 6.24/08

Thank you for replying.

I checked my root-config and the Python 3 versions match (v3.6.8). Where it the standard location of the ROOT install on LXPLUS? I have not sourced thisroot.sh I expect this is the issue but I don’t know where thisroot.sh is located.

Self answer (for lxplus):

  1. Activate your virtual environment, install any required Python packages.
  2. Once activated source the appropriate thisroot.sh. Located at
/cvmfs/sft.cern.ch/lcg/app/releases/ROOT/<version>/<platform>

on LXPLUS. You can check the version required by running “root --version”.
You will need to source the thisroot.sh every time you re-enter the virtual env.

rpm -qf /usr/bin/root
rpm -ql python2-root
rpm -ql python36-root