RuntimeError: missing Environment: _ZN08NumbaEnv4ROOT13_ numbadeclare13pywrapper$242Ei

It seems the issue is actually related to having a print statement in the jitted code! It’s the same problem as this bug report; "RuntimeError: missing Environment" using print in second call to cached numba function · Issue #3555 · numba/numba · GitHub

The environment was fine, actually, I can get ROOT out of the Athena setup and it’s still fine. So, putting everything together, my setup is;

setupATLAS
asetup Athena 22.0.77
export LCGENV_PATH=/cvmfs/sft.cern.ch/lcg/releases
export PATH=/cvmfs/sft.cern.ch/lcg/releases/lcgenv/latest:${PATH}
eval "`lcgenv -p LCG_101 x86_64-centos7-gcc11-opt numba 0.51.2`"

Then I can run;

import ROOT
ROOT.xAOD.Init()
r_frame = ROOT.RDataFrame("CollectionTree", "DAOD_PHYSLITE.root")
print("jit a function")
@ROOT.Numba.Declare(['int'], 'int')
def simple_func(inp):
    return 2*inp
print("Use on a data frame")
r_frame2 = r_frame.Define('simple', 'Numba::simple_func(2)')
r_frame2.Mean('simple').GetValue()

Hopefully this helps someone else, because it took a while to figure out what was breaking things.
Also, I guess a newer version of numba would remove this bug, but this is the only one I have on lcg right now.

1 Like