Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 9 Next »

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

The following command will create a jupyter kernel from an existing mamba environment:

Do not activate the environment when running this command.

$ mkjupy <environment> "Icon Label"
 
Example (do not activate the nobel environment):
$ mkjupy nobel "nobel"
 
Expected output example:
$ Installed kernelspec nobel in /home/spock/.local/share/jupyter/kernels/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. If interested, please come by office hours!

Removing a Kernel from the Web App

From the terminal, execute the following commands (once again assuming a fresh shell session).

This will only remove the kernel entry in Jupyter and does not affect 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.

Creating Kernels from a Data Directory

Since the command above only works for environments installed in the user’s home, to make a kernel from environments installed in /data directory:

  1. If needed, re-create the env in this /data directory, then each user in your group can access this env and make a kernel from it.

  2. Activate the env

  3. Once the env is activated, install "ipykernel" with mamba: mamba install -c anaconda ipykernel

  4. Then each user can make a kernel from this env for themselves: 

    1. They need to activate this env first by source activate ENV

    2. python -m ipykernel install --user --name=<exact name of the env>

Additional Help

If you require further assistance on this topic, please contact the Research Computing Team. To create a support ticket review our RTO Request Help page. For quick inquiries, reach out via our #rc-support Slack Channel or attend our office hours for live assistance.

We also offer a series of Educational Opportunities and Workshops.

  • No labels