Home | News | Documentation | Download

Pyroot through macports broken

When I try to get root 6.22 through macports, root generally works fine, but pyroot is broken and can’t be imported. In python (3.7) if I import ROOT I get

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ROOT/__init__.py in <module>
     26 environ['CPPYY_NO_ROOT_FILTER'] = '1'
---> 28 import cppyy
     30 # import libROOTPythonizations with Python version number

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cppyy/__init__.py in <module>
     72     from ._pypy_cppyy import *
     73 else:
---> 74     from ._cpython_cppyy import *

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cppyy/_cpython_cppyy.py in <module>
     18 # first load the dependency libraries of the backend, then pull in the
     19 # libcppyy extension module
---> 20 c = loader.load_cpp_backend()
     21 import libcppyy as _backend
     22 _backend._cpp_backend = c

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cppyy_backend/loader.py in load_cpp_backend()
     73     if not c:
---> 74         raise RuntimeError("could not load cppyy_backend library")
     76     return c

RuntimeError: could not load cppyy_backend library

I’ve completely wiped root from macports, and verified nothing was left. I also verified that cppyy was gone from the site packages of the python installation.

sudo port install root6 +python37

works fine (about an hour to compile). Generally in python I can’t import ccppy_backend or ccppy.

If I look in /opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cppyy_backend/lib I see the following:

libCling.so		libCoreLegacy.so	libRIOLegacy.so		libThreadLegacy.so
libCoreLegacy.rootmap	libRIOLegacy.rootmap	libThreadLegacy.rootmap	libcppyy_backend.so

Any suggestions?

Many thanks,

ROOT Version: root6 (macports) @6.22.02_0+cocoa+davix+graphviz+gsl+opengl+python37+roofit+tmva+xml+xrootd (active)
Platform: Mac OSX 10.14.6
Compiler: Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Python: 3.7.9
IPython: 7.18.1

Hi @bleu65,

I think @jonesc is the maintainer of https://ports.macports.org/port/root6/summary
@jonesc can you please take a look?


works fine for me, with python 3.8 (the default version used by the root port).

Oberon ~/Projects/MacPorts/ports > python3.8
Python 3.8.5 (default, Sep  6 2020, 03:54:05) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> ROOT.TBrowser()
<cppyy.gbl.TBrowser object at 0x7f8553ca3650>

Can you please try with python 3.8 and see if that works for you ?

1 Like

OK, I think I can reproduce with python 3.8, by directly trying to import cppyy.

I think this is probably another instance of problems I have had in the past with the ROOT build system not really completely playing ball with the way MacPorts handles its python installations. I have always had to maintain a few post-destroot fixes up to get things to work, and this looks like another.

Hi @jonesc,
feel free to open a GitHub issue if you think we can improve this on ROOT’s side.



I can, but this is painful as I have to change all of my python ports to now be py38. I think first I’ll try compiling an older version of ROOT myself outside macports (having the same issue you had with 6.22 compiling it Compilation Error for 6.22 on Mac). If I can just get an older version compiled and use that, it means I don’t have to change my whole setup.

It sounds like there is still a problem though if cppyy is imported directly though.


Just wait a until you try anything. I will likely push a work around for the ROOT installation issues to MacPorts shortly.

1 Like

please try pulling that into your local checkout and update.

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