HPC High Performance Computing: 8.2. Jupyter Notebook

Jupyter Notebook

Run an interactive job reserving 16 GB of memory in order to install the packages in the environment:

nsurname@ohpc:~$ salloc -w node002 -p high --mem 16GB 

Load Anaconda3 or Miniconda3 module:

nsurname@node001:~$ module load Miniconda3/4.9.2

Create the virtual environment installing Jupyterlab and Jupyter:

nsurname@node001:~$ conda create -n jupyter python=3.9 jupyterlab jupyter

Load the bash shell:

nsurname@node001:~$ eval "$(conda shell.bash hook)"

Activate the virtual environment:

nsurname@node001:~$ conda activate jupyter

Run Jupyter Notebook. The application default port is 8888:

(jupyter) [nsurname@node001 ~]$ jupyter notebook --no-browser --ip='0.0.0.0' --port=8888

Find in which node is running the job and the port that Jupyter Notebook is using, in this case, it is the node001 and the port number 8888. 

Open a new terminal session and create a SSH tunneling:

 ssh -p 22 -L 16008:node001:8888 nsurname@hpc.s.upf.edu

Open a browser in your computer and connect to the following URL:

 http://localhost:16008/

In this case, you will have to add the token of the URL in the "Password or token" field. You can also access directly if you paste the URL:

http://127.0.0.1:8888/tree?token=427245a6807f383929b2837521d9dd8ad56165cefbbe7be0

And replace 8888 for 16008.