Skip to content

Jupyter ROOT kernel crashes on cell revision #21942

@wgseligman

Description

@wgseligman

Check duplicate issues.

  • Checked for duplicates

Description

I'm setting up a new JupyterHub installation at my site. As part of my standard ROOT tutorial, I have the students deliberately cause an error and fix it. They cut-and-paste this pyroot example:

from ROOT import TH1D, TCanvas
my_canvas = TCanvas("mycanvas","canvas title",800,600)
example = TH1D("example","example histogram",100,-3,3)
example.FillRandom("gaus",10000)
exomple.Draw("E")
my_canvas.Draw()

This fails with a NameError. So far, so good. I tell them to change exomple to example and run it again.

What I expect to happen: The code executes and draws a histogram.

What actually happens: The kernel crashes.

After the kernel is restarted the revised code works, but this doesn't make a good example for students who might use a notebook for the first time.

This example has been part of my ROOT tutorial for over a decade. Up until ROOT 6.30, it behaved exactly as expected. I only started getting the kernel crash when I set up a fresh jupyterhub installation with ROOT 6.38.

I spent hours trying to figure out the problem. I isolated it to the creation of the TCanvas; if I comment out those lines, the test behaves as expected. The only error message I see in the log (even with the pykernel --debug option is:

Apr 17 06:15:05 notebook-gamma jupyterhub-singleuser[3234]: [I 2026-04-17 06:15:05.810 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), keep random ports

Based on web searches on AsyncIOLoopKernelRestarter, all this tells me that is that the kernel crashed and Jupyter tries to restart it.

BEFORE YOU ASK ME FOR MORE DEBUGGING INFORMATION:

As a test, I went to SWAN. I created a new notebook with exactly the same code, and tested exomple then example. EXACTLY THE SAME THING HAPPENS ON SWAN!

This is not a local "I installed the JupyterHub/Jupyter/ROOT stack incorrectly" problem. Whatever is going wrong is part of the current distribution of ROOT at CERN.

Reproducer

Steps to reproduce the problem:

  • Start a Jupyter pyroot notebook (such as SWAN).

  • Paste the following code into a cell:

from ROOT import TH1D, TCanvas
my_canvas = TCanvas("mycanvas","canvas title",800,600)
example = TH1D("example","example histogram",100,-3,3)
example.FillRandom("gaus",10000)
exomple.Draw("E")
my_canvas.Draw()
  • Execute the cell to see the NameError.

  • Correct exomple to example (or do any other type of Python error repair)

  • Execute the cell again.

ROOT version

  | Welcome to ROOT 6.38.04                        https://root.cern |
  | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Apr 08 2026, 08:58:36                 |
  | From tags/6-38-04@6-38-04                                        |
  | With  std202002                                                  |

Installation method

conda create -y -n jupyterhub jupyterhub jupyterlab ipywidgets nodejs root

Operating system

AlmaLinux release 9.7 (Moss Jungle Cat)

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions