Jupyter-Teaching: Difference between revisions

From Research Computing Center Wiki
Jump to navigation Jump to search
No edit summary
 
(7 intermediate revisions by 2 users not shown)
Line 10: Line 10:
=== Version ===
=== Version ===


6.0.2
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.0.2 is installed at /apps/eb/JupyterLab/1.2.5-foss-2019b-Python-3.7.4
*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.'''
To use Jupyter notebook 6.0.2, please load the module:
<pre class="gcommand" >
module load JupyterLab/1.2.5-foss-2019b-Python-3.7.4
</pre>


<!--
<!--
Line 65: 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'''


====To use Jupyter notebook on sapelo2 with an interactive job====
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:


'''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'''
<pre class="gcommand">
interact            # wait for interactive session to start


Sample steps to use jupyter 6.0.3, once you connect to sapelo2:
NOTEBOOKPORT=8888   # must change this to a random number between 8000 and 10000
<pre class="gcommand" >
qlogin
 
NOTEBOOKPORT=8888


IPUSED=$(hostname -i)
IPUSED=$(hostname -i)
Line 82: Line 77:
echo "IPUSED is " $IPUSED
echo "IPUSED is " $IPUSED


module load Anaconda3/2020.02
module load Anaconda3/2022.10


jupyter-notebook --port $NOTEBOOKPORT --ip=$IPUSED --no-browser
jupyter-notebook --port $NOTEBOOKPORT --ip=$IPUSED --no-browser
Line 88: Line 83:
</pre>
</pre>


After running the steps above, establish a another ssh tunnel from your desktop or laptop to sapelo2 login node at port NOTEBOOKPORT.  
====<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.  


'''For Mac/Linux Users'''
To establish another ssh tunnel, follow the steps below for your OS


If you are using a Linux or Apple machine for your desktop or laptop you can use the following command to establish the ssh tunnel
* '''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)
'''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@sapelo2.gacrc.uga.edu  
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.
# Download the '''[https://the.earth.li/~sgtatham/putty/latest/x86/plink.exe plink program]''' to use in place of the ssh client
The command for windows would be as follows:
# Open a Windows Terminal
Assuming the plink.exe is in the current directory where you have a command window open.
# 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@sapelo2.gacrc.uga.edu
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:


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:
<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 11:16:00.939 NotebookApp] JupyterLab extension loaded from /apps/eb/Anaconda3/2020.02/lib/python3.7/site-packages/jupyterlab
[I 14:34:50.424 NotebookApp] http://10.31.32.126:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
[I 11:16:00.939 NotebookApp] JupyterLab application directory is /apps/eb/Anaconda3/2020.02/share/jupyter/lab
[I 14:34:50.424 NotebookApp]  or http://127.0.0.1:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
[I 11:16:00.942 NotebookApp] Serving notebooks from local directory: /home/zhuofei
[I 14:34:50.424 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 11:16:00.942 NotebookApp] The Jupyter Notebook is running at:
[C 14:34:50.431 NotebookApp]  
[I 11:16:00.942 NotebookApp] http://10.2.1.30:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb
[I 11:16:00.942 NotebookApp]  or http://127.0.0.1:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb
[I 11:16:00.942 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:16:00.947 NotebookApp]  
      
      
     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-14353-open.html
         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.2.1.30:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb
         http://10.31.32.126:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
     or http://127.0.0.1:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb
     or http://127.0.0.1:8888/?token=cf8fbaace953bbae0b31df9556a97d0930702fd65b7cfaaf
</pre>
</pre>


Copy and paste the token, which in the example above is 857f8a9f63cf42f698ac1845db64219516a23e248019cdeb, into the proper field in the page displayed in your browser.
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

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