JupyterLab-Teaching: Difference between revisions

From Research Computing Center Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 36: Line 36:


<!--
<!--
'''To use Jupyter notebook on sapelo2'''
'''To use Jupyter notebook on Teaching cluster'''


To run Jupyter notebook on sapelo2 you have to submit a job to the queueing system that will run the jupyter notebook server and establish a ssh tunnel from the compute node to the login node.
To run Jupyter notebook on Teaching cluster you have to submit a job to the queueing system that will run the jupyter notebook server and establish a ssh tunnel from the compute node to the login node.
You will then have to establish another ssh tunnel from your computer to the login node that will let you connect to the jupyter notebook instance.
You will then have to establish another ssh tunnel from your computer to the login node that will let you connect to the jupyter notebook instance.


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



Revision as of 13:01, 16 June 2021

Category

Programming

Program On

Teaching

Version

1.2.5

Author / Distributor

JupyterLab

Description

"JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data." JupyterLab

Running Program

Versions

Please also refer to Running Jobs on Sapelo2.

  • JupyterLab 1.2.5 is installed at /apps/eb/JupyterLab/1.2.5-foss-2019b-Python-3.7.4

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

To use JupyterLab 1.2.5, please load the module:

module load JupyterLab/1.2.5-foss-2019b-Python-3.7.4


To use Jupyter notebook on sapelo2 with an interactive job

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.0.3, once you connect to sapelo2:

qlogin

NOTEBOOKPORT=8888

IPUSED=$(hostname -i)

echo "NOTEBOOKPORT is " $NOTEBOOKPORT

echo "IPUSED is " $IPUSED

module load Anaconda3/2020.02

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

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

For Mac/Linux Users

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

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@sapelo2.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@sapelo2.gacrc.uga.edu

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 11:16:00.939 NotebookApp] JupyterLab extension loaded from /apps/eb/Anaconda3/2020.02/lib/python3.7/site-packages/jupyterlab
[I 11:16:00.939 NotebookApp] JupyterLab application directory is /apps/eb/Anaconda3/2020.02/share/jupyter/lab
[I 11:16:00.942 NotebookApp] Serving notebooks from local directory: /home/zhuofei
[I 11:16:00.942 NotebookApp] The Jupyter Notebook is running at:
[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:
        file:///home/zhuofei/.local/share/jupyter/runtime/nbserver-14353-open.html
    Or copy and paste one of these URLs:
        http://10.2.1.30:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb
     or http://127.0.0.1:8888/?token=857f8a9f63cf42f698ac1845db64219516a23e248019cdeb

Copy and paste the token, which in the example above is 857f8a9f63cf42f698ac1845db64219516a23e248019cdeb, 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