Difference between revisions of "Jupyter-Teaching"

From Research Computing Center Wiki
Jump to navigation Jump to search
Line 31: Line 31:
 
'''Please note: You do not have to install jupyter notebook on your local machine.'''
 
'''Please note: You do not have to install jupyter notebook on your local machine.'''
  
To use Jupyter notebook 6.4.12, please load the module:
 
<pre class="gcommand">
 
module load Anaconda3/2022.10
 
</pre>
 
 
<!--
 
<!--
 
'''To use Jupyter notebook on sapelo2'''
 
'''To use Jupyter notebook on sapelo2'''
Line 64: Line 60:
 
This will check for the presence of ssh keys and it will create and add it to authorized_keys file if needed.
 
This will check for the presence of ssh keys and it will create and add it to authorized_keys file if needed.
 
-->
 
-->
====To use Jupyter notebook on Teaching cluster with an interactive job====
+
===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'''
 
'''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'''
  
Line 87: Line 83:
 
</pre>
 
</pre>
  
After running the steps above, '''establish a another ssh tunnel''' from your desktop or laptop to Teaching cluster login node at port NOTEBOOKPORT.  
+
====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
 
To establish another ssh tunnel, follow the steps below for your OS
  
'''For Mac/Linux Users'''
+
* '''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
 
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
Line 102: Line 99:
 
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.
 
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'''
+
* '''For Windows Users'''
  
 
If you are using a Windows machine for your desktop or laptop download the '''[https://the.earth.li/~sgtatham/putty/latest/x86/plink.exe plink program]''' to use in place of the ssh client.
 
If you are using a Windows machine for your desktop or laptop download the '''[https://the.earth.li/~sgtatham/putty/latest/x86/plink.exe plink program]''' to use in place of the ssh client.
Line 112: Line 109:
 
plink -ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu
 
plink -ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu
 
</pre>
 
</pre>
 
+
====Step 3====
 
Once you establish the ssh tunnel by running the command above you can access the Jupyter notebook 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 qlogin session). If the page displayed on the browser asks for a token or password, you can check the token shown in your qlogin session and copy and paste it into the token field in the page displayed in your browser. For example, the qlogin terminal might show something like this:
 
Once you establish the ssh tunnel by running the command above you can access the Jupyter notebook 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 qlogin session). If the page displayed on the browser asks for a token or password, you can check the token shown in your qlogin session and copy and paste it into the token field in the page displayed in your browser. For example, the qlogin terminal might show something like this:
  

Revision as of 17:30, 2 February 2024

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 connected to Teaching cluster:

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 download the plink program to use in place of the ssh client. The command for windows would be as follows: Assuming the plink.exe is in the current directory where you have a command window open.

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 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 qlogin session). If the page displayed on the browser asks for a token or password, you can check the token shown in your qlogin session and copy and paste it into the token field in the page displayed in your browser. For example, the qlogin 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