I am trying to get a jupyterhub setup working without k8s, and where every user has a local linux account (via LDAP). I have it mostly working, but can’t figure out how to trim down the kernel list to what I want (which is just one kernel to start with).
The system currently sees 2 kernels, but I can’t get rid of one of them, and have no idea how it is getting identified as a kernel (since there is no kernel.json
file, and I don’t even understand how the path can be found.
This is what I mean:
$ jupyter kernelspec list
Available kernels:
python3 /srv/jupyterhub/launching_venv/lib64/python3.12/site-packages/ipykernel/resources
py312_kernel /home/war12184/.local/share/jupyter/kernels/py312_kernel
$ jupyter kernelspec remove python3
Couldn't find kernel spec(s): python3
$ # Cannot remove!? Check how it was identified...
$ ls -al /srv/jupyterhub/launching_venv/lib64/python3.12/site-packages/ipykernel/resources
total 24
drwxr-sr-x. 2 war12184 jhubadmins 70 Jul 4 01:10 .
drwxr-sr-x. 8 war12184 jhubadmins 4096 Jul 4 01:10 ..
-rw-r--r--. 1 war12184 jhubadmins 1084 Jul 4 01:10 logo-32x32.png
-rw-r--r--. 1 war12184 jhubadmins 2180 Jul 4 01:10 logo-64x64.png
-rw-r--r--. 1 war12184 jhubadmins 9605 Jul 4 01:10 logo-svg.svg
(jupyterhub) [war12184@OTTAPPJHUBPRD01 jupyterhub]$
Why can’t I remove that kernel? How is it even being detected? I only want the py312_kernel
that has been set up.
I’m generally having a lot of whack-a-mole problems trying to get the PATH
and PYTHONPATH
working properly between the python process/env that launches jupyterhub
, through the spawner, and into the actual running python kernel.
System setup is as follows:
- system-level jupyterhub stuff located in
/srv/jupyterhub/
- jupyterhub launched from a specific venv with only
jupyterhub
in it- launching venv is in
/srv/jupyterhub/launching_venv/
- jupyterhub is v5.0.0
- python running jupyterhub is python 3.12
- launching venv is in
- A single “seed” kernel in
/srv/jupyterhub/seed_kernels/py312_kernel
- this is just a venv on its own
- this kernel will NOT be used directly
- Used as a source to create user-specific venvs for kernels
- User-specific kernels created using a
pre_spawn_hook
that creates venvs (and registers kernels) from the seed venv(s) above- the
pre_spawn_hook
creates a venv from the seed kernel (e.g./srv/jupyterhub/seed_kernels/py312_kernel/bin/python -m venv ~/.jupyter_kernels/from_seeds/py312
- kernels are locally registered with
~/.jupyter_kernels/from_seeds/py312/bin/python -m ipykernel install --user --name {kernel_name}
- the
The local kernel creation described above is working well. However, I can’t seem to make it the only kernel! I am unable to get rid of the other kernel, adn can’t figure out why it exists. Worse, it is the default kernel! Even worse, the sys.executable
for the kernel is the python running jupyterhub itself, namely /srv/jupyterhub/launching_venv/bin/python3.12
.
What is wrong with my setup? How do I eliminate the unwanted kernel?