Jupyter-Teaching: Difference between revisions
No edit summary |
(→Step 2) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
=== Version === | === Version === | ||
6. | 6.4.12 | ||
=== Author / Distributor === | ===Author / Distributor=== | ||
[https://jupyter.readthedocs.io/en/latest/releases.html#jupyter-notebook Jupyter] | [https://jupyter.readthedocs.io/en/latest/releases.html#jupyter-notebook Jupyter] | ||
=== Description === | ===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" [https://jupyter.readthedocs.io/en/latest/index.html Jupyter] | "The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text" [https://jupyter.readthedocs.io/en/latest/index.html Jupyter] | ||
=== Running Program === | ===Running Program=== | ||
====Versions==== | ====Versions==== | ||
Line 26: | Line 26: | ||
Please also refer to [[Running Jobs on the teaching cluster]]. | Please also refer to [[Running Jobs on the teaching cluster]]. | ||
* Jupyter 6. | *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.''' | '''Please note: You do not have to install jupyter notebook on your local machine.''' | ||
<!-- | <!-- | ||
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=== | |||
====<u>Step 1</u>==== | |||
'''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: | |||
<pre class="gcommand"> | |||
<pre class="gcommand" > | interact # wait for interactive session to start | ||
NOTEBOOKPORT=8888 | NOTEBOOKPORT=8888 # must change this to a random number between 8000 and 10000 | ||
IPUSED=$(hostname -i) | IPUSED=$(hostname -i) | ||
Line 81: | Line 77: | ||
echo "IPUSED is " $IPUSED | echo "IPUSED is " $IPUSED | ||
module load Anaconda3/ | module load Anaconda3/2022.10 | ||
jupyter-notebook --port $NOTEBOOKPORT --ip=$IPUSED --no-browser | jupyter-notebook --port $NOTEBOOKPORT --ip=$IPUSED --no-browser | ||
Line 87: | Line 83: | ||
</pre> | </pre> | ||
After running the steps above, establish | ====<u>Step 2</u>==== | ||
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''' | * '''For Mac/Linux Users''' | ||
If you are using a Linux or Apple machine for your desktop or laptop | 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) | '''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) | ||
<pre class="gcommand" > | <pre class="gcommand"> | ||
ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@ | ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu | ||
</pre> | </pre> | ||
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 | 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 | |||
# Open a Windows Terminal | |||
# Navigate to the location where the plink.exe file was downloaded | |||
## For example, if plink.exe was downloaded to your Downloads folder you could type '''cd C:\Users\yourusername\Downloads''' | |||
## 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 | |||
# 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) | '''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) | ||
<pre class="gcommand" > | <pre class="gcommand"> | ||
plink -ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@ | plink -ssh -N -L NOTEBOOKPORT:IPUSED:NOTEBOOKPORT username@teach.gacrc.uga.edu | ||
</pre> | </pre> | ||
====<u>Step 3</u>==== | |||
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: | |||
<pre class="gcommand"> | |||
[I 14:34:50.423 NotebookApp] Serving notebooks from local directory: /home/zhuofei | |||
<pre class="gcommand" > | [I 14:34:50.423 NotebookApp] The Jupyter Notebook is running at: | ||
[I | [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). | |||
[I | [C 14:34:50.431 NotebookApp] | ||
[I | |||
[I | |||
[I | |||
[C | |||
To access the notebook, open this file in a browser: | To access the notebook, open this file in a browser: | ||
file:///home/zhuofei/.local/share/jupyter/runtime/nbserver- | file:///home/zhuofei/.local/share/jupyter/runtime/nbserver-3690-open.html | ||
Or copy and paste one of these URLs: | Or copy and paste one of these URLs: | ||
http://10. | http://10.31.32.126:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf | ||
or http://127.0.0.1:8888/?token= | or http://127.0.0.1:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf | ||
</pre> | </pre> | ||
Copy and paste the token, which in the example above is | Copy and paste the token, which in the example above is cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf, into the proper field in the page displayed in your browser. | ||
=== Documentation === | ===Documentation=== | ||
Details at https://jupyter.readthedocs.io/en/latest/index.html | Details at https://jupyter.readthedocs.io/en/latest/index.html | ||
=== System === | ===System=== | ||
64-bit Linux | 64-bit Linux |
Latest revision as of 14:33, 8 February 2024
Category
Programming
Program On
Teaching
Version
6.4.12
Author / Distributor
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
- Download the plink program to use in place of the ssh client
- Open a Windows Terminal
- Navigate to the location where the plink.exe file was downloaded
- For example, if plink.exe was downloaded to your Downloads folder you could type cd C:\Users\yourusername\Downloads
- 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
- 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