JupyterLab-Teaching

From Research Computing Center Wiki
Jump to navigation Jump to search

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 Teaching cluster 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 notebook , once you connect to Teaching cluster:

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