PyROOT at LXplus

Dear Supporters,
I set up my virtualenv at lxplus7 with a number of python libraries. When I use ROOT under python, it complains “No module named ROOT”. I read all old threads suggesting setting up ROOTSYS etc, but those links are no longer working and directories are absent.

Could you please provide a set of commands which will bring ROOT to python in the virtualenv.

Thanks,
RFK

lxplus has ROOT installed into /usr, but there is a bug in the packaging that makes PyROOT stop working. If you use Python 3.x, just export PYTHONPATH=/usr/lib64/root and you can use PyROOT normally. I will file a SNOW ticket to ask them to downgrade to ROOT 6.16 while this is not fixed in Fedora and EPEL.

Thank you for the reply, Amadio! Here is what I got:

  1. With python 2.7

$ python
Python 2.7.5 (default, Jun 20 2019, 20:27:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ROOT

  1. With python 3.6 after doing the export

$ python3.6
Python 3.6.8 (default, Apr 25 2019, 21:02:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib64/python3.6/site-packages/ROOT.py”, line 24, in
import cppyy
File “/usr/lib64/python3.6/site-packages/cppyy.py”, line 61, in
import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)

Could you tell me please what I am missing?

Thanks,
RFK

Did you export PYTHONPATH=/usr/lib64/root?

~ $ ssh lxplus
Password: 
Last login: Wed Jul 24 16:45:10 2019 from epsft-gentoo.dyndns.cern.ch
* ********************************************************************
* Welcome to lxplus776.cern.ch, CentOS, 7.6.1810
* Archive of news is available in /etc/motd-archive
* Reminder: you have agreed to the CERN
*   computing rules, in particular OC5. CERN implements
*   the measures necessary to ensure compliance.
*   https://cern.ch/ComputingRules
* Puppet environment: production, Roger state: production
* Foreman hostgroup: lxplus/nodes/login
* Availability zone: cern-geneva-b
* LXPLUS Public Login Service - https://cern.ch/lxplusdoc
* lxplus alias switch to CC7 on Apr 2nd 2019 . http://cern.ch/go/K7lq
* ********************************************************************
lxplus ~ $ export PYTHONPATH=/usr/lib64/root
lxplus ~ $ python
Python 2.7.5 (default, Jun 20 2019, 20:27:34) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> 

Thank you, Amadio! I guess this is related to the virtualenv, where I keep a dozen of python libraries, but no ROOT.

$ export PYTHONPATH=/usr/lib64/root

(virtualenv_1) $ python
Python 2.7.5 (default, Jun 20 2019, 20:27:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ROOT
quit()

(virtualenv_1) $ deactivate

$ python
Python 2.7.5 (default, Jun 20 2019, 20:27:34)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import ROOT

import parquet
Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib64/python2.7/site-packages/ROOT.py”, line 531, in _importhook
return _orig_ihook( name, *args, **kwds )
ImportError: No module named parquet

So far I have either ROOT and no extra libraries, or my libraries in virtualenv and no ROOT. I was wondering how to add then ROOT to libraries.

Thanks,
RFK

Hello there,
I want to confirm that I have a similar situation on lxplus with python3:

$ ssh @lxplus.cern.ch 
* ********************************************************************
* Welcome to lxplus765.cern.ch, CentOS, 7.6.1810
* Archive of news is available in /etc/motd-archive
* Reminder: you have agreed to the CERN
*   computing rules, in particular OC5. CERN implements
*   the measures necessary to ensure compliance.
*   https://cern.ch/ComputingRules
* Puppet environment: production, Roger state: production
* Foreman hostgroup: lxplus/nodes/login
* Availability zone: cern-geneva-c
* LXPLUS Public Login Service - https://cern.ch/lxplusdoc
* lxplus alias switch to CC7 on Apr 2nd 2019 . http://cern.ch/go/K7lq
* ******************************************************************** 
$ export PYTHONPATH=/usr/lib64/root
$ python -c "import ROOT"
$ python3
Python 3.6.8 (default, Apr 25 2019, 21:02:35) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.6/site-packages/ROOT.py", line 24, in <module>
    import cppyy
  File "/usr/lib64/python3.6/site-packages/cppyy.py", line 61, in <module>
    import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)
$ which python
/usr/bin/python
$ which python3
/usr/bin/python3

It works fine with python 2.7.5 but not with python 3.6.8.

Thanks

I have reported this to Fedora and to lxplus system administrators. Hopefully ROOT will be downgraded back to 6.16 in lxplus while this bug is not resolved. For now, it will only work with Python 2.x, unfortunately, and only after exporting PYTHONPATH, as I mentioned in my other comment.

@RFK Do you use LCG software in your virtualenv? How do you set things up?

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