Preparing Python Environments for Jupyter
Overview
This article describes how to add your Mamba environments to Jupyter to use as a notebook kernel. You can learn about creating Mamba environments in Managing Python Modules Through the Mamba Environment Manager.
Creating the Jupyter Kernel
From the shell, add the kernel to the web user interface with the following command:
$ mkjupy <environment> "Icon Label"
Example:
$ mkjupy nobel "nobel"
This takes the environment called nobel
and creates a Jupyter kernel for it. When creating a new notebook, it will have an Icon labeled nobel
.
Use the Environment in Jupyter Hub
In the web portal, create a new interactive session after selecting Jupyter from the server list. The new kernel is now available for driving notebooks!
Customizing logos is possible but not currently documented due to potential complexity.
Removing a Kernel from Jupyter
From the terminal, execute the following commands (once again assuming a fresh shell session).
This will only remove the kernel entry in Jupyter, and has no effect on the environment.
$ module load mamba/latest
$ jupyter kernelspec remove nobel
Kernel specs to remove:
nobel /home/jyalim/.local/share/jupyter/kernels/nobel
Remove 1 kernel specs [y/N]: y
[RemoveKernelSpec] Removed /home/jyalim/.local/share/jupyter/kernels/nobel
Remove the kernel by the environment name, not the Jupyter kernel title.