When I use jupyter lab
, there are several kernels I can choose:
root@DESKTOP-L60P4Q8:~/arcta/live2# jupyter kernelspec list
Available kernels:
julia-1.9 /root/.local/share/jupyter/kernels/julia-1.9
mojo-jupyter-kernel /root/.local/share/jupyter/kernels/mojo-jupyter-kernel
rust /root/.local/share/jupyter/kernels/rust
python3 /usr/local/share/jupyter/kernels/python3
But when I use jupyterhub
, there is only one kernel I can choose:
How can I setup the jupyterhub_config, so that I can choose the kernels like in jupyterlab?
You need to install those kernels in your single user environment for them to appear on JupyterLab spawned by JupyterHub. How to install them depends on your deployment. How did you deploy your JupyterHub?
I install jupyterhub
with using the command pip install jupyterhub
. And here is my jupyterhub_cofig.py
:
c = get_config() # noqa
from jupyterhub.auth import DummyAuthenticator
c.JupyterHub.authenticator_class = DummyAuthenticator
from jupyterhub.spawner import SimpleLocalProcessSpawner
c.JupyterHub.spawner_class = SimpleLocalProcessSpawner
c.Spawner.default_url = '/lab'
c.Spawner.args = ["--allow-root"]
And then I just run the command jupyterhub -f jupyterhub_config.py
So, in the same environment you ran pip install jupyterhub
, you will need to install kernels as well like pip install <mojo_kernel> <julia_kernel> <rust_kernel>
.
2 Likes
Thank you very much for your help. I finally found out that I installed jupyterhub
and kernel
s as you said, they are in the same environment. The error came from the jupyterhub_config.py
:
c = get_config() # noqa
from jupyterhub.auth import DummyAuthenticator
c.JupyterHub.authenticator_class = DummyAuthenticator
from jupyterhub.spawner import SimpleLocalProcessSpawner
c.JupyterHub.spawner_class = SimpleLocalProcessSpawner
c.Spawner.default_url = '/lab'
c.Spawner.args = ["--allow-root"]
Some code in there must have changed the environment. After I commenting the code except for the last two lines, I can select kernels the same way as in jupyterlab
.
1 Like