See https://github.com/sagemath/sage/issues/40605#issuecomment-3368103016 
and the referenced issue in the jupyter repo for more details.

On Wednesday, January 7, 2026 at 1:03:21 AM UTC+1 Nils Bruin wrote:

> 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.
> (the info is here: 
> https://doc.sagemath.org/html/en/reference/repl/sage/repl/ipython_kernel/install.html
>  
> )
>
> 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
>
>
> https://doc.sagemath.org/html/en/installation/launching.html#setting-up-sagemath-as-a-jupyter-kernel-in-an-existing-jupyter-notebook-or-jupyterlab-installation
>
> 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!)
> On Tuesday, 6 January 2026 at 12:48:41 UTC-8 Nils Bruin wrote:
>
>> 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?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/267922b4-a736-4609-858f-72bd2dca11e6n%40googlegroups.com.

Reply via email to