Skip to main content

JupyterNotebook Custom kernel

Python VENV

To install a custom kernel with whatever python modules you prefer please run the following, either via an ssh session to an hpc system or via the terminal application within jupyterhub:

python3 -m venv ~/venvs/mytorch
. ~/venvs/mytorch/bin/activate
pip install torch torchvision torchaudio ipykernel
python -m ipykernel install --user --name=mytorch --display-name "My PyTorch"

(note that mytorch and "My PyTorch" are placeholders and can be changed to whatever you prefer)

Screenshot from 2025-05-22 10-44-13.png

Once completed you will see your custom kernel in jupyterhub every time you launch it:

Screenshot from 2025-05-22 10-40-51.png

you can also change your kernel at any time by selecting the Kernel dropdown menu:

Screenshot from 2025-05-22 10-46-30.png

Screenshot from 2025-05-22 10-46-54.png

Anaconda

conda create -n mytorch python=3.10 -y
conda activate mytorch
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia ipykernel -y
python -m ipykernel install --user --name=mytorch --display-name "My PyTorch (Conda)"

(note that mytorch and "My PyTorch" are placeholders and can be changed to whatever you prefer)

Screenshot from 2025-05-22 10-44-13.png

Once completed you will see your custom kernel in jupyterhub every time you launch it:

Screenshot from 2025-05-22 10-40-51.png

you can also change your kernel at any time by selecting the Kernel dropdown menu:

Screenshot from 2025-05-22 10-46-30.png

Screenshot from 2025-05-22 10-46-54.png