Jupyter-Teaching

From Research Computing Center Wiki
Jump to navigation Jump to search

Category

Programming

Program On

Teaching

Version

6.4.12

Author / Distributor

Jupyter

Description

"The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text" Jupyter

Running Program

Versions

Please also refer to Running Jobs on the teaching cluster.

  • Jupyter 6.4.12 can be accessed through Anaconda version 2022.10 which is installed at /apps/eb/Anaconda3/2022.10


Please note: You do not have to install jupyter notebook on your local machine.

To use Jupyter notebook on Teaching cluster with an interactive job

Step 1

The port number for the jupyter notebook server should be some random value between 8000 and 10000. Assign this value to the variable 'NOTEBOOKPORT' in the submission script below replacing 8888. Please do not use 8888. If more than one person uses that same value you cannot establish the ssh tunnel

Sample steps to use jupyter 6.4.12, once you are connected to Teaching cluster, type each line below one by one, pressing enter after each one:

interact             # wait for interactive session to start

NOTEBOOKPORT=8888    # must change this to a random number between 8000 and 10000

IPUSED=$(hostname -i)

echo "NOTEBOOKPORT is " $NOTEBOOKPORT

echo "IPUSED is " $IPUSED

module load Anaconda3/2022.10

jupyter-notebook --port $NOTEBOOKPORT --ip=$IPUSED --no-browser

Step 2

After running the steps above, establish another ssh tunnel from your desktop or laptop to Teaching cluster login node at port NOTEBOOKPORT.

To establish another ssh tunnel, follow the steps below for your OS

  • For Mac/Linux Users

If you are using a Linux or Apple machine for your desktop or laptop, open a new terminal use the following command to establish the ssh tunnel between the two terminals

Make sure you replace NOTEBOOKPORT and IPUSED below with the port number and the IP address you are using (see the output of the echo commands above)

ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu 

Unless you have ssh key configured, you will be prompted for your MyID password and for Archpass Duo authentication. Once authentication is established, this session prompt will hang and you are ready to go to the next step.

  • For Windows Users

If you are using a Windows machine for your desktop or laptop

  1. Download the plink program to use in place of the ssh client
  2. Open a Windows Terminal
  3. Navigate to the location where the plink.exe file was downloaded
    1. For example, if plink.exe was downloaded to your Downloads folder you could type cd C:\Users\yourusername\Downloads
    2. You can check that you are in the same location as plink.exe by simply typing dir into the Windows Terminal. This command works the same as ls for linux and just lists the contents of your current location so if you see plink.exe in the output of the dir command, then you know you are in the same location as the plink.exe file
  4. Then you can type the command below into the Windows Terminal:

Make sure you replace NOTEBOOKPORT and IPUSED below with the port number and the IP address you are using (see the output of the echo commands above)

plink -ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu

Step 3

Once you establish the ssh tunnel by running the command above you can access the Jupyter notebook by copy and pasting on the URLs from your interactive session into a browser OR by going to http://localhost:NOTEBOOKPORT using the browser on your desktop or laptop (make sure you replace NOTEBOOKPORT with the port number you used in the interactive session). If the page displayed on the browser asks for a token or password, you can check the token shown in your interactive session and copy and paste it into the token field in the page displayed in your browser. For example, the interact terminal might show something like this:

[I 14:34:50.423 NotebookApp] Serving notebooks from local directory: /home/zhuofei
[I 14:34:50.423 NotebookApp] The Jupyter Notebook is running at:
[I 14:34:50.424 NotebookApp] http://10.31.32.126:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
[I 14:34:50.424 NotebookApp]  or http://127.0.0.1:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
[I 14:34:50.424 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:34:50.431 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/zhuofei/.local/share/jupyter/runtime/nbserver-3690-open.html
    Or copy and paste one of these URLs:
        http://10.31.32.126:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
     or http://127.0.0.1:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf

Copy and paste the token, which in the example above is cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf, into the proper field in the page displayed in your browser.

Documentation

Details at https://jupyter.readthedocs.io/en/latest/index.html

System

64-bit Linux