Some problem about pyroot

I met a problem after installing root/6.24/00 when using python3. The problem happens when I try to import the ROOT as follow

~ % python3
Python 3.9.2 (default, Mar 15 2021, 10:13:36) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>import ROOT
Traceback (most recent call last):
  File "/Applications/root_v6.24.00/lib/cppyy/", line 60, in <module>
  File "/opt/homebrew/Cellar/python@3.9/3.9.2_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'libcppyy3_9'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Applications/root_v6.24.00/lib/ROOT/", line 22, in <module>
    import cppyy
  File "/Applications/root_v6.24.00/lib/cppyy/", line 62, in <module>
    raise ImportError(
ImportError: Failed to import libcppyy3_9. Please check that ROOT has been built for

Actually, there is no such problem when using version 6.22/08.
And, it’s OK when using python 2.7 instead of version 3.9.2.
Is it the problem of ROOT? If so, I think I need some help to solve this problem in the next version, and this post may serve like a feedback.
If it’s the problem of my computer, how can I solve it?

Python 3.9
_ROOT Version:6.24/00 (Built for macosxarm64)
_Platform:MacBookAir (M1) macOS Big Sur 11.3


According to the message this indicates that the ROOT installation you are using was not built for Python3.9 (but it was for Python2.7, since you can use it with that version as you commented).

Can you check with the following commands:

root-config --python-version
root-config --python2-version
root-config --python3-version

I did it and got the following results:

~ % root-config --python-version 
~ % root-config --python2-version
~ % root-config --python3-version

I think that it indicates that there is no installation built for Python3.9.
Thank you.

Yes indeed, your ROOT installation was not built for Python3.9.

You can build your own ROOT for Python3.9 if you wish. The instructions are here:

and more specifically, for the PyROOT part:

You basically need to make sure the Python3.9 installation is found when building (you’ll need to check the CMake messages when configuring, it will tell you if it found Python3.9 and will build PyROOT for it).

OK, I’ll try it. Thank you so much!

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