I have installed root on my mac with brew - so far so good and I can open root and see that root v.32.06 is installed. However, when trying to execute a pyroot code, I get this
python3 -c "import ROOT; print(ROOT.__version__)" Traceback (most recent call last): File "<string>", line 1, in <module> import ROOT; print(ROOT.__version__) ^^^^^^^^^^^ File "/opt/homebrew/Cellar/root/6.32.06/lib/root/ROOT/__init__.py", line 25, in <module> import cppyy File "/opt/homebrew/Cellar/root/6.32.06/lib/root/cppyy/__init__.py", line 81, in <module> from ._cpython_cppyy import * File "/opt/homebrew/Cellar/root/6.32.06/lib/root/cppyy/_cpython_cppyy.py", line 22, in <module> import libcppyy as _backend ImportError: dlopen(/opt/homebrew/Cellar/root/6.32.06/lib/root/libcppyy.so, 0x0002): symbol not found in flat namespace '__Py_HashPointer'
while compiling unfortunatelly, I get into errors…
Built target MetaCling While building module 'Core': While building module 'Darwin' imported from /Users/alkaloge/root-build/include/TSystem.h:27: In file included from <module-includes>:358: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/curses.h:2918: /opt/local/include/unctrl.h:61:54: error: conflicting types for 'unctrl' NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype); ^ /opt/local/include/unctrl.h:58:38: note: previous declaration is here NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype); ^ While building module 'Core': While building module 'Darwin' imported from /Users/alkaloge/root-build/include/TSystem.h:27: In file included from <module-includes>:362: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/form.h:39: /opt/local/include/curses.h:684:45: error: functions that differ only in their return type cannot be overloaded extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */ ...
That’s weird. Compilation should work. You did exactly what I proposed ? You started from a clean root-build folder ? it looks like the errors come from Xcode include. Is there any XCode update available on you machine ?
The homebrew team was very fast in their reply. As you can read from the link provided above, apparently the packages is built with Python 3.12, so that Python version must be used when using ROOT from Python. I will ask the homebrew team if this is something that can be embedded in the formula so that this type of mismatch does not happen again in the future.
And just for reference, if I follow the homebrew dev’s suggestion and I use python3.12 (installed via brew install python@3.12) on my machine, then ROOT works
python3.12
Python 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>>
Damn…The problem seems to still be there for me - I installed root with brew, then when trying to run my pyroot
> python3 Fit.py Traceback (most recent call last): File "/Users/alkaloge/Paper/METPaper/AN-21-167/Fit.py", line 1, in <module> import ROOT File "/opt/homebrew/Cellar/root/6.32.06/lib/root/ROOT/__init__.py", line 25, in <module> import cppyy File "/opt/homebrew/Cellar/root/6.32.06/lib/root/cppyy/__init__.py", line 81, in <module> from ._cpython_cppyy import * File "/opt/homebrew/Cellar/root/6.32.06/lib/root/cppyy/_cpython_cppyy.py", line 22, in <module> import libcppyy as _backend ImportError: dlopen(/opt/homebrew/Cellar/root/6.32.06/lib/root/libcppyy.so, 0x0002): symbol not found in flat namespace '__Py_HashPointer'
although I now have the right python version python3 --version Python 3.13.0
I also trying to donwnload and compile, but compilation fails…