jupyter lab with 10.9.beta1

60 views
Skip to first unread message

Nils Bruin

unread,
Jan 6, 2026, 3:48:41 PM (2 days ago) Jan 6
to sage-devel
It seems that 10.9.beta1 has broken the jupyter kernel functionality in sage.

The kernel used to live in

<SAGE_ROOT>/venv/share/jupyter/kernels/sagemath

In fact, the files are still there but they don't point to the right kernel anymore. It does seem to be the kernelspec that gets picked up, both by `jupyter lab` and by `sage --notebook jupyterlab`, but the kernel fails to initialize (probably because it's pointing to files that don't exist).

Where is the kernel living nowadays?

Nils Bruin

unread,
Jan 6, 2026, 7:03:21 PM (2 days ago) Jan 6
to sage-devel
OK, I made some progress on this. 

Even to get the kernel working properly for "sage --notebook jupyterlab" I needed to manually run

from sage.repl.ipython_kernel.install import Sage
KernelSpec SageKernelSpec.update()

I would have expected this to be done for me as it was before.

This ends up installing the kernel in `~/.local/share/jupyter/kernels`. That directory also gets used by the system `jupyter lab` but the kernel as installed doesn't run properly because it assume sage's venv, which isn't active when you just run `jupyter lab`.

I ended up editing the kernel.json to read:

{"argv": ["sage", "--python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"], "display_name": "SageMath", "language": "sage"}

so that the kernel gets started through python as sage starts it (assuming "sage" is in the path).

In particular, the instructions in


don't work properly, because the kernelspec file that is installed assumes the venv is already activated, which is not the case when jupyter is run normally. In fact it shouldn't be: it's entirely possible to have  kernels installed that depend on pip --user installs. Those are generally screened out in a venv. So the right thing to do is to run the jupyter server in whatever environment is usual and only activate the venv for the sage kernel.

Something did break recently in the updating of these kernels. I suspect when things got switched over to meson (which still hangs for 4 minutes before proceeding with an install!)

Tobia...@gmx.de

unread,
Jan 7, 2026, 7:11:30 AM (yesterday) Jan 7
to sage-devel
See https://github.com/sagemath/sage/issues/40605#issuecomment-3368103016 and the referenced issue in the jupyter repo for more details.
Reply all
Reply to author
Forward
0 new messages