# Running interactive Jupyter notebook on Rackham ![](https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/207px-Jupyter_logo.svg.png =x60) ## 1. Start an interactive session from the login node ``` bash # For Rackham $ interactive -A snic-project -t 4:00:00 # For Snowy $ interactive -M snowy -A snic-project -t 4:00:00 ``` ## 2. Start jupyter notebook from the interactive session (*when it gets allocated*) ``` bash $ module load python/3.9.5 $ jupyter notebook --ip 0.0.0.0 --no-browser ``` ## 3. Connect to the running notebook Keep this session open and running. Note the node on which you are got the interactive job i.e. something like "r141". - If you are connected to Rackham via [Thinlinc session](https://www.uppmax.uu.se/support/user-guides/thinlinc-graphical-connection-guide/), open a browser with the link you got but modified to point to r141 i.e. http://r141:8888/?token=5c3aeee9fbfc75f7a11c4a64b2b5b7ec49622231388241c2 - If you use ssh to connect to Rackham, you need to forward the port of the interactive node to your local computer. - On Linux or Mac this is done by running in another terminal. Make sure you have the ports changed if they are not at the default 8888. ``` bash $ ssh -L 8888:r141:8888 username@rackham.uppmax.uu.se ``` - If you use PuTTY - you need to change the settings in "Tunnels" accordingly (could be done for the current connection as well). ![](https://i.imgur.com/hmcXE0N.png) https://uplogix.com/docs/local-manager-user-guide/advanced-features/ssh-port-forwarding On your computer open the address you got but replace r141 with localhost i.e. http://localhost:8888/?token=5c3aeee9fbfc75f7a11c4a64b2b5b7ec49622231388241c2 This should bring the jupyter interface on your computer and all calculations and files will be on Rackham. ## Tutorial from other HPC computer centers [Running Jupyter on Slurm](https://nero-docs.stanford.edu/jupyter-slurm.html) ## Connect to this remote Jupyter notebook server from VSCode 1. Follow the instructions above to start Jupyter server on an interactive node and forward the port locally to your computer. 2. Follow this guide from VSCode https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_connect-to-a-remote-jupyter-server 3. When asked for the URI provide the one you have assembled for your local browser ![](https://i.imgur.com/L3JM53N.png) 4. Create "New Jupyter notebook". Note that the the information bar will indicate that you are using a remote server ![](https://i.imgur.com/junmjUU.png) 5. Test it to confirm that it is running on the interactive compute node. ![](https://i.imgur.com/2d3eW7B.png) # Contacts: - [Pavlin Mitev](https://katalog.uu.se/profile/?id=N3-1425) - [UPPMAX](https://www.uppmax.uu.se/) - [SNIC AE@UPPMAX - related documentation](/8sqXISVRRquPDSw9o1DizQ) ![](https://snic.se/digitalAssets/603/c_603880-l_1-k_image.png =122x38) ![](https://live.webb.uu.se/digitalAssets/207/c_207717-l_3-k_bg-city.png) ###### tags: `UPPMAX`, `SNIC`, `jupyter notebook`, `RT225511`, `VSCode`