-1

jupyterhub run with jupytrerlab on my vps (archlinux) in a venv.

Sagemath is installed at /usr/bin/sage.

venv/bin/jupyter kernelspec list or sudo venv/bin/jupyter kernelspec list return

Available kernels:
  python3     /truc/opt/jupyterhub/share/jupyter/kernels/python3
  sagemath    /usr/share/jupyter/kernels/sagemath

/usr/share/jupyter/kernels/sagemath/kernel.json.in contain

{'argv': ['/usr/bin/sage',
  '--python',
  '-m',
  'sage.repl.ipython_kernel',
  '-f',
  '{connection_file}'],
 'display_name': 'SageMath 10.7',
 'language': 'sage'}

When i log in a web browser to jupyterlab, all icons are correct.

Python 3 (ipykernel) work well, but when i click on SageMath 10.7 console, the console opening don't print something like

SageMath version 10.7, Release Date: 2025-08-09                    │
│ Using Python 3.13.7. Type "help()" for help.

but instead simply suspension points and nothing works.

Is somebody may tell me what i did wrong?

1
  • You mention 'console'. Does the same thing happen when you try running a notebook with that kernel? Does the console/shell/terminal you are running the server for Jupyter from show any details when you try to start the kernel for SageMath? The first code block from this unrelated post is what I am trying to describe. If you scroll down you'll see things like Instantiating kernel 'Python 3 (ipykernel)' with kernel provisioner: local-provisioner and Starting kernel: ['/Users/ .... Again, it isn't meant to be related but what you want to be looking for to debug further. Commented Sep 25 at 14:34

1 Answer 1

0

I eventually found a solution.

I think it's not clean but it works.

It uses Installing the SageMath Jupyter Kernel and Extensions.

# venv/bin/python
>>> from sage.all import *
>>> from sage.repl.ipython_kernel.install import SageKernelSpec
>>> prefix = tmp_dir()
>>> spec = SageKernelSpec(prefix=prefix)
>>> spec.kernel_spec()

I correct each error by a symbolic link.

sudo ln -s /usr/lib/python3.13/site-packages/sage venv/lib/python3.13/site-packages/
sudo ln -s /usr/lib/python3.13/site-packages/cysignals venv/lib/python3.13/site-packages/
sudo ln -s /usr/lib/python3.13/site-packages/gmpy2 venv/lib/python3.13/site-packages/
sudo ln -s /usr/lib/python3.13/site-packages/cypari2 venv/lib/python3.13/site-packages/
sudo ln -s /usr/lib/python3.13/site-packages/memory_allocator venv/lib/python3.13/site-packages/

And finally,

>>> spec.kernel_spec()  
{'argv': ['venv/bin/sage', '--python', '-m', 'sage.repl.ipython_kernel', '-f', '{connection_file}'], 'display_name': 'SageMath 10.7', 'language': 'sage'}

I put this in /usr/share/jupyter/kernels/sagemath/kernel.json.in
and it works.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.