Home | News | Documentation | Download

Pyroot broken in brew again

ROOT Version: v6-22-08
Platform: Mac OS X 11.3
Compiler: clang 12.0.0 (root installed via brew)

I’m trying to import root in python after installing via brew.

First I got warnings about cppyy missing. This went away with “pip install cppy”.

Then I ran into this error:

I fixed it with the env var recommended by Axel in that post (updating the path to point to the appropriate file on my system).

But pyroot still doesn’t load. Importing anything from ROOT within python gives:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/root/6.22.08/lib/root/ROOT/__init__.py", line 22, in <module>
    import cppyy
  File "/usr/local/Cellar/root/6.22.08/lib/root/cppyy/__init__.py", line 131, in <module>
    from ._cpython_cppyy import *
  File "/usr/local/Cellar/root/6.22.08/lib/root/cppyy/_cpython_cppyy.py", line 18, in <module>
    c = loader.load_cpp_backend()
  File "/usr/local/lib/python3.9/site-packages/cppyy_backend/loader.py", line 79, in load_cpp_backend
    c, err2 = _load_helper(name)
  File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
TypeError: function name must be string, bytes object or integer

Hi @jasondet,

It seems that you are still having problems while loading libcppyy_backend.so. I am not an expert in this area of ROOT, but it seems it might be related to the corresponding ctypes.CDLL() call. I am sure @etejedor can point you in the right direction.



Your ROOT installation is using the cppyy_backend package that you installed separately, instead of its own (so ROOT’s cppyy and the cppyy you installed separately are mixing).

I’d try to go back to the situation where you got the “cppyy missing” warnings and we can try to solve it from there. In your previous post, I understood it was working. What changed?