Skip to content

Managing Software

The LEAPHub environment provides multiple ways to install and manage software. Choose the method that best fits your needs.

Quick Installs (Temporary)

When you just need software for your current notebook session, you can temporarily install packages using one of the following methods. The lifetime of the installation lasts until the kernel stops. After this, it has to be re-installed.

Note

Each shell command listed can also be run inside an active Jupyter Notebook by prefixing them with an exclamation mark (i.e. running !pip install numpy in a code cell).

1. Pip

You can install Python libraries published on Pypi with: pip install <package-name>

2. Conda / Mamba

If you prefer conda/mamba or have non-python dependencies you can install packages with: mamba install <package>

3. Script

If you are installing the same packages every time you start a new session, you can add the install commands in a script. This is especially useful for workshops or group work.

Create a .sh file with the following skeletal code:

#!/bin/bash
conda install -y <package> <package> 
pip install <package>
echo "Environment ready!"

Then in the terminal run the following code to make the script executable: chmod +x setup-env.sh

You can now execute the script in your terminal by the following: ./<filename>.sh

Persistent Installs (Docker Image)

In some cases, a custom Docker image is required to ensure that software packages are installed persistently across kernel restarts. Unlike runtime installations, which are temporary and must be re-run each session, a custom image guarantees that packages are available every time a user starts a new server.

Use a custom image for the following scenarios:

  • When multiple users need the same libraries
  • When setting up workshops, bootcamps, or other workflows
  • When packages take a long time to install or have complex dependencies
  • When Jupyter extensions must be pre-built to function properly (ex: AmazonQ, classic labextensions, etc)

If you find yourself installing the same packages repeatedly, or if runtime installs are unreliable or time-consuming, consider moving to a custom image for a more stable and efficient experience.

For instructions on creating and managing a custom image, see the 2i2c hub-user-image guide

How to use a custom image in the LEAP Hub:

  1. Go to the Start Server page in JupyterHub. (include link to screenshot here)

  2. Select Other... from the Image options dropdown. Then enter the link to the custom image in the form of <registry>/<username>/<repo_name>:<git-commit-hash> (include link to screenshot here)

  3. Launch the server - your packages will be pre-installed.