Failed to import ROOT in jupyter notebook in docker fedora 36


ROOT Version: 6.26/06
Platform: Fedora 36 in docker
Compiler: g++


When I run import ROOT in a jupyter notebook started as root --notebook --allow-root --no-browser --ip=0.0.0.0, I got the following error message:

Error in callback <bound method CaptureDrawnPrimitives._post_execute of <JupyROOT.helpers.utils.CaptureDrawnPrimitives object at 0x7f6e28ecbc70>> (for post_execute):

IncrementalExecutor::executeFunction: symbol '_ZN4ROOT12Experimental7RCanvas11GetCanvasesEv' unresolved while linking symbol '__cf_18'!
You are probably missing the definition of ROOT::Experimental::RCanvas::GetCanvases()
Maybe you need to load the corresponding shared library?

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File /usr/lib64/python3.10/site-packages/JupyROOT/helpers/utils.py:461, in CaptureDrawnPrimitives._post_execute(self)
    460 def _post_execute(self):
--> 461     NotebookDraw()

File /usr/lib64/python3.10/site-packages/JupyROOT/helpers/utils.py:451, in NotebookDraw()
    449 DrawGeometry()
    450 DrawCanvases()
--> 451 DrawRCanvases()

File /usr/lib64/python3.10/site-packages/JupyROOT/helpers/utils.py:444, in DrawRCanvases()
    443 def DrawRCanvases():
--> 444     rdrawers = GetRCanvasDrawers()
    445     for drawer in rdrawers:
    446         drawer.Draw()

File /usr/lib64/python3.10/site-packages/JupyROOT/helpers/utils.py:416, in GetRCanvasDrawers()
    414 def GetRCanvasDrawers():
    415     if not RCanvasAvailable(): return []
--> 416     lOfC = ROOT.Experimental.RCanvas.GetCanvases()
    417     return [NotebookDrawer(can.__smartptr__().get()) for can in lOfC if can.IsShown()]

ValueError: static const vector<shared_ptr<ROOT::Experimental::RCanvas> > ROOT::Experimental::RCanvas::GetCanvases() =>
    ValueError: nullptr result where temporary expected

But if I run import ROOT in ipython in the same container, everything is fine.

I installed root using dnf install root python3-jupyroot. The output of root-config --features is

cxx17 asimage builtin_clang builtin_cling builtin_llvm builtin_openui5
dataframe davix dcache exceptions fftw3 fitsio fortran gdml gfal gnuinstall
gsl_shared gviz http fcgi imt mathmore mlp minuit2 mysql odbc opengl pgsql
pyroot pythia8 qt5web rroofit webgui root7 shadowpw shared soversion sqlite
ssl tmva tmva-cpu tmva-sofie tmva-pymva tmva-rmva spectrum unuran uring x11
xml xrootd

Please let me know if you need more information to figure out what causes the problem.

Thanks, Jing

Hi @jingliu ,

it looks like there is a hook that is executed when starting ROOT in a notebook that tries to load and use ROOT7 graphics. The maintainers of the Fedora ROOT package split ROOT into several sub-packages, so my guess is that you don’t have a necessary ROOT sub-package install (the one that provides ROOT::Experimental::RCanvas::GetCanvases()).

Given the list here: root - Fedora Packages my guess is that you need root-graf-gpadv7 . You could/should report to the maintainers of the Fedora packages that this dependency is missing.

Cheers,
Enrico

Hi, Enrico, you nailed it! Thank you! Jing