Using cppyy and ROOT together

Hi, is there a way to use cppyy and ROOT together? Installing cppyy seems to cause ROOT to load the wrong version of cppyy it uses and cause a loading fail.

> python
Python 3.7.4 (default, Oct  4 2019, 06:57:26) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cppyy
>>> import ROOT
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/ROOT.py", line 198, in <module>
    _root.SetSignalPolicy( _root.kSignalSafe )
AttributeError: module 'libcppyy' has no attribute 'SetSignalPolicy'
>>> 

Hi,
I understand you installed both ROOT and the newest cppyy?
PyROOT uses an internal cppyy python module, and this looks like a clash of the new cppyy you installed and that internal cppyy of ROOT. So it will be problematic to try to use them at the same time.
On the other hand, we are now working on a new PyROOT that is built on top of the new cppyy. When we make that PyROOT the default, you will be able to use the new cppyy too. But that is not going to happen before mid next year.

HI, good to know ROOT is updating. Is there a way to call ROOT’s internal cppyy? I want to avoid writing code like this

if use_cppyy:
    cppyy.include(header)
else: # use ROOT
    ROOT.gSystem.ProcessLine("#include <{}>".format(header))

Hi,

You can use ROOT’s internal cppyy if you do not have the new cppyy installed. But ROOT’s cppyy does not have all the functionality of the new cppyy (e.g. it does not have a function to include headers).

I believe the decision depends on whether you want to benefit from the extra features ROOT provides (e.g. pythonisations of ROOT classes like making TTree iterable in Python, interactive graphics from the Python prompt, etc.) or you just want the C++ - Python bindings.

Enric

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