Pyroot with python3

Hi Rooters,

very long time I haven’t been here :grinning:
Here my problem under python3

import ROOT

gives

ImportError: Failed to import libcppyy3_9. Please check that ROOT has been built for Python 3.9

But it works with python2.7

root-config --python-version gives 2.7.16

So I am wondering if I can change this to python3 ?
I have seen that > PyROOT will be built for the most recent Python3 and Python2
Thanks
Olivier

_ROOT Version: root6.24.06
I use the root precompiled binary for
_Platform:OS X10.15.7
_Compiler:Xcode 11.5

Thanks for your quick answer.
I took the root binaries from here:

and there is no specification about python version … Do I need to build root my self with the good python version ?
and yes I have sourced thisroot.sh

Execute the three “python” related commands given in my link.

ok I understand I have Python 3.9.6
and root was built for Python 3.9.5
I will downgrade and see if it works
thanks

Sorry but it seems that there is no file named : libcppyy3_9 in the lib/ folder
Only lib related to python 2.7 (libcppy2_7.6.24.so)
I am wondering if in the precompiled root binaries python3 have been selected …
thanks

So indeed libcppyy3_9.so was missing.
I have recompiled the source now it works

I think the easiest solution for this is to do it manually, we do not have such function in the ROOT Profile class.
You can do it before filling as suggested before, but you need to compute first the averages …

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