pyROOT issues


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

_ROOT Version: 6.32.08
_Platform: mac sonoma Version 14.7.1
_Compiler:Apple clang version 16.0.0


When I try to run import ROOT on python, I get this:

dysonk@pn2501594 ~/Work/LFVLNV/AnalysisAndSuch$ python3
Python 3.11.7 (main, Nov 21 2024, 09:57:30) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/ROOT/__init__.py", line 25, in <module>
    import cppyy
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/cppyy/__init__.py", line 81, in <module>
    from ._cpython_cppyy import *
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/cppyy/_cpython_cppyy.py", line 22, in <module>
    import libcppyy as _backend
ImportError: dlopen(/opt/homebrew/Cellar/root/6.32.08/lib/root/libcppyy.so, 0x0002): symbol not found in flat namespace '_PyObject_DelAttr'

my .zshrc is as follows:

alias ll='la -alF'
alias la='ls -A'
alias l='l -CF'
PS1='%n@%m %~$ '
export PATH="$PATH:/Users/dysonk/Library/Python/3.9/bin"
export ROOTSYS="/opt/homebrew/Cellar/root/6.32.08"
export LD_LIBRARY_PATH=$ROOTSYS/lib:$PYTHONDIR/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH

eval "$(pyenv init --path)"
source /opt/homebrew/Cellar/root/6.32.08/bin/thisroot.sh

Hi Dyson,

Sorry to read ROOT did not work out of the box for you.
I see at least something which should perhaps be understood better in the information you shared (thanks by the way). It seems you are importing ROOT in Python 3.11, while you add version 3.9 to the path: can you exclude that you are dealing with a Python version mismatch?

Cheers,
D

Thanks for your reply. I have cleaned out any potential mismatch and am now using a venv for python 3.9.6. It looks like the issue persists:

(.venv) dysonk@pn2501594 ~/Work/LFVLNV/AnalysisAndSuch$ which python
/Users/dysonk/.venv/bin/python
(.venv) dysonk@pn2501594 ~/Work/LFVLNV/AnalysisAndSuch$ python --version
Python 3.9.6
(.venv) dysonk@pn2501594 ~/Work/LFVLNV/AnalysisAndSuch$ python
Python 3.9.6 (default, Oct  4 2024, 08:01:31) 
[Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/ROOT/__init__.py", line 25, in <module>
    import cppyy
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/cppyy/__init__.py", line 81, in <module>
    from ._cpython_cppyy import *
  File "/opt/homebrew/Cellar/root/6.32.08/lib/root/cppyy/_cpython_cppyy.py", line 22, in <module>
    import libcppyy as _backend
ImportError: dlopen(/opt/homebrew/Cellar/root/6.32.08/lib/root/libcppyy.so, 0x0002): symbol not found in flat namespace '_PyObject_DelAttr'
>>> 

Hi,

Thanks. I was looking at the Brew page for ROOT 6.32.08 [1] here. It seems that it depends on Python 3.13 while I understand from the snippet you start Python 3.9.6 - is this perhaps a source of troubles?

Cheers,
Danilo

[1] By the way, the page is extremely well done - once again, we are really grateful to all our packagers!

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