Skip to content

jsroot from pip install root not working in notebooks (no TWebCanvas?) #20472

@will-cern

Description

@will-cern

Check duplicate issues.

  • Checked for duplicates

Description

Just reporting here that the pip install version of root in a jupyter notebook (e.g. google colab) the default drawing fails (just create any drawable object and try to draw the canvas):

    309     if TWebCanvasAvailable():
--> 310         return ROOT.TWebCanvas.CreateCanvasJSON(canvas, 23, True)
    311 
    312     # Add extra primitives to canvas with custom colors, palette, gStyle

AttributeError: <class cppyy.gbl.TWebCanvas at 0x3d259af0> has no attribute 'CreateCanvasJSON'. Full details:
  type object 'TWebCanvas' has no attribute 'CreateCanvasJSON'
  'TWebCanvas::CreateCanvasJSON' is not a known C++ class
  'CreateCanvasJSON' is not a known C++ template
  'CreateCanvasJSON' is not a known C++ enum

I note that the following is True:

hasattr(ROOT, "TWebCanvas")

But ROOT.TWebCanvas is just a cppyy shell object. Has the pythonization here incorrectly determined that class as being part of the build?

Anyway ... temporary workaround is to disable jsroot %jsroot off)

Reproducer

!pip install root
import ROOT
c = ROOT.TCanvas()
c.Draw()

in a notebook

ROOT version

6.37.01

Installation method

pip install

Operating system

linux (google colab)

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions