How to get started with pyroot?

Dear Experts,
I have little experience in ROOT but I am very much new to pyroot. I was trying to run one of the existing code in the tutorials/pyroot/ but I am getting the following error and this error I am getting for all the codes.

I guess I am doing some mistake while doing setup/source.
The error looks like following:
Traceback (most recent call last):
*** File “”, line 12, in ***
*** from ROOT import TCanvas, TPad, TFile, TPaveLabel, TPaveText***
*** File “/home/souvik/mydir/lib/”, line 24, in ***
*** import cppyy***
*** File “/home/souvik/mydir/lib/”, line 61, in ***
*** import libPyROOT as _backend***
ImportError: dynamic module does not define module export function (PyInit_libPyROOT)

Could you please suggest me how to resolve this issue so that I can start with pyroot.

Thanks in Advance.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

I think @etejedor can help you.


The issue is that you are executing your Python script with Python3 but ROOT was compiled with Python2, or the other way around. Please use the Python version that ROOT was built with.

We now have the possibility to build ROOT for both Python2 and Python3, but that is only available in master at the moment.

Thanks a lot. It worked.

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