Jupyter
This topic describes how TAs set up one or more Jupyter environments for their students.

Courses that use Jupyter must provide an environment for all students in the course.
Simple Setup
On a
login node, the following script creates a minimal Jupyter environment in
/cluster/courses/{course tag}/jupyter:
/cluster/jupyter/setup-for-course.sh {course tag}

The script installs Jupyter version 4 with the jupyterlab-server-timer extension, which shows the remaining time of the server job in the status bar. The extension only works with Jupyter version 4. To use an older Jupyter version, uninstall the extension before downgrading.

The script must not use a private python3 from a home directory, because students cannot access it.
Multiple Environments
To create additional environments, run the script with a directory name as the second argument:
/cluster/jupyter/setup-for-course.sh {course tag} {directory name}
This creates the environment under
/cluster/courses/{course tag}/{directory name}.
To select a specific Python version, set
PYTHON:
PYTHON=3.11 /cluster/jupyter/setup-for-course.sh {course tag} {directory name}
Enabling Environments in the Hub
The environments shown in the hub are listed in the YAML file
/cluster/courses/{course tag}/environments.yaml
By default, it only contains the first environment created. Further environments can be added, and their names changed to tell students what each environment is for. If
default is set to
true for one environment, it is selected automatically when a student selects the course on the hub's start page.
Adding Packages
To add packages, activate the environment:
. /cluster/courses/{course tag}/jupyter/bin/activate
and install the packages with
pip.
If the installation needs a specific CUDA version, activate it as described
here. If the environment also needs this CUDA version at runtime, add the same module to the
modules: field in
environments.yaml.
Starting Over
If something goes wrong, delete the environment and create it again.