Trying to use ROOT in Python. Downloaded ROOT via macports. Following error when I try to import ROOT:
~/repos$ python
>>> import ROOT
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cppyy/__init__.py", line 60, in <module>
importlib.import_module(libcppyy_mod_name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1176, in create_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/libcppyy3_10.so, 0x0002): Library not loaded: @rpath/libcppyy_backend3_10.6.26.so
Referenced from: /opt/local/libexec/root6/lib/root/libcppyy3_10.6.26.00.so
Reason: tried: '/Users/stuartwalker/repos/bdsim/install/bin/../lib/libcppyy_backend3_10.6.26.so' (no such file), '/opt/local/libexec/root6/lib/root/../lib/root/libcppyy_backend3_10.6.26.so' (no such file), '/opt/local/libexec/root6/lib/root/../lib/root/libcppyy_backend3_10.6.26.so' (no such file), '/usr/local/lib/libcppyy_backend3_10.6.26.so' (no such file), '/usr/lib/libcppyy_backend3_10.6.26.so' (no such file)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ROOT/__init__.py", line 22, in <module>
import cppyy
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/cppyy/__init__.py", line 62, in <module>
raise ImportError(
ImportError: Failed to import libcppyy3_10. Please check that ROOT has been built for Python 3.10
Just for sanity, I checked the versions and yes they match:
~/repos$ python --version
Python 3.10.2
and
~/repos$ root-config --python3-version
3.10.2
So the versions definitely match. What is there to be done?
ROOT still doesn’t really work on arm it seems. It is still not possible to compile ROOT from source on arm mac (due to error in compiling the bundled freetype, why can’t I use my own builtin freetype btw? Why must I use the packaged one?). The .pkg doesn’t produce any runnable binaries (no idea why). ROOT from conda also crashes. So nothing works. I think macports is my best bet. But I need pyROOT. Any tips? What is going on?
Please help me. Thank you for your time.
ROOT Version: 6.26/00
Platform: macosxarm64 / macOS Monterey (12.1)
Compiler: used macports precompiled binary