ROOT and python3

Before this I always manage to get ROOT install with python3, and always make sure that the libraries and include dir is for python3.6

however the latest version of ROOT 6.10, tried with 6.10/00, 6.10/02 and even 6.10/04, I could cmake and build it but I could not get root to work in python. All these on CentOS 7

For one things is I could not yum install libldap-dev and gsl-static as those package are not available

Are those package required for python3 to build properly for root to work with python?

Hi Danny,

what is the problem you are encountering?


Python 3.6.2 (default, Jul 28 2017, 17:11:27) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] 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 "/home/kenk/root/lib/", line 24, in <module>
    import cppyy
  File "/home/kenk/root/lib/", line 61, in <module>
    import libPyROOT as _backend
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)

I build root from source with python3 enable and python disable, I even make sure that the PYTHON_LIBRARY and PYTHON_INCLUDE_DIR pointing to the ones in python3.6.

I always manage to do it before on my other machine but not this time for some reason.


Please try passing the option -Dpython3=ON to CMake, as explained here. If that doesn’t work, you may have better luck if you downgrade to Python 3.5. Cheers,

1 Like

Here is another issue that may be useful if you run into problems with Python 3.6.

Okay, downgrading my python to 3.5 does not seem to be working either. I did pass the option of

to cmake.

I also attached a screenshot of the settings for cmake for python portion in the cmake-gui.

CMake Deprecation Warning at cmake/modules/RootNewMacros.cmake:8 (cmake_policy):
  The OLD behavior for policy CMP0022 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:34 (include)

Also had this warning at the start of cmake /source I realised this is probably safe to ignore but I thought include here just in case.

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