How to Run JupyterLab via Conda
This page describes how to run JupyterLab with Conda on Pawsey systems with Slurm. This involves launching JupyterLab and then connecting to the Jupyter server. Although containers are our preferred method of running JupyterLab, they do not facilitate custom software installation on the fly.
Overview
The first step in using JupyterLab is to make it available on the supercomputer via Conda. Then, you will need to prepare a batch script to execute the JupyterLab server on a compute node. Finally, when you are finished, you will need to clean up the session.
Installing the software with Conda
The following packages are required to run JupyerLab via Conda. You can install them to a new or existing environment, along with other packages that you may need for your analysis. You can also do pip install
from your notebook later if needed.
conda install -c conda-forge jupyterlab -y conda install conda-forge::nodejs -y conda install conda-forge::jupyter-server-proxy -y
Setting up the batch script
The following script launches a Jupyter notebook on a compute node. The first step is to enter a writable directory with some space, such as /scratch
, to launch the notebook. Create a directory where you will start our Jupyter notebook container and put any relevant data or Jupyter notebooks in this directory.
Run your Jupyter notebook server
To start, submit the SLURM jobscript. It will take a few minutes to start (depending on how busy the queue and how large of an image you're downloading). Once the job starts you will have a SLURM output file in your directory, which will have instructions on how to connect at the end.
In your local computer, open a separate terminal window and execute SSH command to create the tunneling among your local port and a port in the compute node. In this case, the instruction provided by the output file is:
ssh -N -f -L 8888:nid001011:8888 <username>@setonix.pawsey.org.au
After this step, you can open up a web browser and use the address displayed in the output file to access your Jupyter notebook. In this example the address is:
http://127.0.0.1:8888/?token=3291a7b1e6ce7791f020df84a7ce3c4d2f3759b5aaaa4242
Alternatively, you could go to the web address http://27.0.0.1:8888
or http://localhost:8888
, and then when prompted insert the token string that comes after "?token=
" above. (Note that your port number might differ from "8888".)
Figure 1. Jupyter authentication page
Note:
The information above is a notebook launched on setonix.pawsey.org.au
. Ensure that you look at your output to select the correct machine.
Clean up when you are finished
Once you have finished:
- In the Pawsey cluster, cancel your job with
scancel
. In your local computer, kill the SSH tunnel, based on the command displayed in the output file:
kill $( ps x | grep 'ssh.*-L *8888:nid001011:8888' | awk '{print $1}' )