Hello,
I was trying to use Numba to jit python function (relying on numpy), to call from an RDataFrame graph. It works (amazing!), but I’m a bit confused about how to import pyROOT to use Numba as ROOT.Numba
.
I thought that from cppyy import gbl as ROOT
and import ROOT
should be equivalent in practice, but that does not seem to be the case:
In [1]: from cppyy import gbl
In [2]: gbl.Numba
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-6f9dc22788fc> in <module>
----> 1 gbl.Numba
AttributeError: <namespace cppyy.gbl at 0x516b4d0> has no attribute 'Numba'. Full details:
type object '' has no attribute 'Numba'
'Numba' is not a known C++ class
'Numba' is not a known C++ template
'Numba' is not a known C++ enum
In [3]: gbl.ROOT.Numba
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-0909b72b901b> in <module>
----> 1 gbl.ROOT.Numba
AttributeError: <namespace cppyy.gbl.ROOT at 0x6d0f060> has no attribute 'Numba'. Full details:
type object 'ROOT' has no attribute 'Numba'
'ROOT::Numba' is not a known C++ class
'Numba' is not a known C++ template
'Numba' is not a known C++ enum
In [4]: import ROOT
In [5]: ROOT.Numba
Out[5]: <namespace cppyy.gbl.Numba at 0x72ce970>
Even stranger, once import ROOT
has been called, this now works:
In [6]: gbl.Numba
Out[6]: <namespace cppyy.gbl.Numba at 0x72ce970>
Could someone help to clarify in which way the different imports are not equivalent, and why using Numba seems to require to import ROOT
?
Cheers,
Sébastien
ROOT Version: 6.24/06
Platform: CC7
Compiler: GCC11