Error in import ROOT

Got this error when trying to run a script that only consists of
import ROOT

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/root/6.26.06_2/lib/root/cppyy/__init__.py", line 60, in <module>
    importlib.import_module(libcppyy_mod_name)
  File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'libcppyy3_11'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ethanyu/Downloads/myScript.py", line 1, in <module>
    import ROOT;
    ^^^^^^^^^^^
  File "/opt/homebrew/Cellar/root/6.26.06_2/lib/root/ROOT/__init__.py", line 22, in <module>
    import cppyy
  File "/opt/homebrew/Cellar/root/6.26.06_2/lib/root/cppyy/__init__.py", line 62, in <module>
    raise ImportError(
ImportError: Failed to import libcppyy3_11. Please check that ROOT has been built for Python 3.11

Note that running root-config --python3-version nets me 3.10.8, whereas python3 --version gets Python 3.11.3.

I’ve also had to run source thisroot.sh to avoid getting ModuleNotFoundError: No module named 'ROOT', but I’ll admit that having to this every time is a little tedious. I’m wondering if I installed root correctly to begin with, but since I did so through homebrew, I’m not sure where it could have went wrong.

ROOT Version: 6.26/06
Platform: MacOS (macosxarm64)
Compiler: Python


Sounds good. Is there a clear timeline for when python 3.11 support would be added?

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