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.

Cheers,
J.

Hello,

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?

Okay – I have a fresh unadulturated install of brew’s root (brew install root). Here’s what I get:

jasondet@Jasons-MacBook-Pro ~ % root --version
ROOT Version: 6.22/08
Built for macosx64 on Mar 10 2021, 14:20:04
From tags/v6-22-08@v6-22-08

jasondet@Jasons-MacBook-Pro ~ %  root-config --has-python
no

jasondet@Jasons-MacBook-Pro ~ % python
Python 3.9.5 (default, May  4 2021, 03:36:27) 
[Clang 12.0.0 (clang-1200.0.32.29)] 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 "/usr/local/Cellar/root/6.22.08_1/lib/root/ROOT/__init__.py", line 22, in <module>
    import cppyy
  File "/usr/local/Cellar/root/6.22.08_1/lib/root/cppyy/__init__.py", line 131, in <module>
    from ._cpython_cppyy import *
  File "/usr/local/Cellar/root/6.22.08_1/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 85, in load_cpp_backend
    raise RuntimeError("could not load cppyy_backend library, details:\n%s" %
RuntimeError: could not load cppyy_backend library, details:
  dlopen(/usr/local/lib/python3.9/site-packages/cppyy_backend/lib/libcppyy_backend3_9.so, 10): image not found
  dlopen(libcppyy_backend3_9.so, 10): image not found
>>> 

I am not an expert but I had issues after installing the latest Xcode. I most likely can’t help you but knowing which Xcode you have will help. 12.5 broke my setup on OSX.

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

This looks like an interference between the cppyy you installed via pip in /usr/local/lib/python3.9/site-packages and the one that comes with ROOT (which you installed via brew). I would recommend to uninstall the former and try again.