JupyterLab: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
(Marked this version for translation)
Line 2: Line 2:
<languages />
<languages />
<translate>
<translate>
== Introduction ==
== Introduction == <!--T:1-->
JupyterLab is now the recommended general-purpose user interface to use on a [[JupyterHub]]. From a JupyterLab server, you can manage your remote files and folders, and you can launch Jupyter applications like a terminal, (Python 3) notebooks, RStudio and a Linux desktop.
JupyterLab is now the recommended general-purpose user interface to use on a [[JupyterHub]]. From a JupyterLab server, you can manage your remote files and folders, and you can launch Jupyter applications like a terminal, (Python 3) notebooks, RStudio and a Linux desktop.


<!--T:2-->
The subsection [[JupyterHub#JupyterHub_on_clusters|JupyterHub on clusters]] contains the list of available Jupyter hubs at Compute Canada.
The subsection [[JupyterHub#JupyterHub_on_clusters|JupyterHub on clusters]] contains the list of available Jupyter hubs at Compute Canada.


== Launching a JupyterLab server as a job ==
== Launching a JupyterLab server as a job == <!--T:3-->
[[File:JupyterHub_Server_Options.png|thumb|''Server Options'' form on Béluga's JupyterHub]]
[[File:JupyterHub_Server_Options.png|thumb|''Server Options'' form on Béluga's JupyterHub]]
On [[JupyterHub#JupyterHub_on_clusters|Béluga and Hélios]], once the authentication is done on [[JupyterHub#JupyterHub_on_clusters|JupyterHub]], your Web browser is redirected to either a) a previously launched Jupyter server or b) a form that allows you to configure and submit a new interactive session on the cluster. In any case, the JupyterLab server is running on dedicated compute resources.
On [[JupyterHub#JupyterHub_on_clusters|Béluga and Hélios]], once the authentication is done on [[JupyterHub#JupyterHub_on_clusters|JupyterHub]], your Web browser is redirected to either a) a previously launched Jupyter server or b) a form that allows you to configure and submit a new interactive session on the cluster. In any case, the JupyterLab server is running on dedicated compute resources.


<!--T:4-->
In the ''Server Options'' form, you can:
In the ''Server Options'' form, you can:
* Set all [[JupyterHub#Compute_resources| compute resources]] options you need for the session
* Set all [[JupyterHub#Compute_resources| compute resources]] options you need for the session
Line 16: Line 18:
* Start the JupyterLab server by clicking the ''Start'' button
* Start the JupyterLab server by clicking the ''Start'' button


== The JupyterLab Interface ==
== The JupyterLab Interface == <!--T:5-->
When JupyterLab is ready to be used, the interface has multiple panels.
When JupyterLab is ready to be used, the interface has multiple panels.
[[File:JupyterLab_HomeTab.png|thumb|Default home tab when JupyterLab is loaded]]
[[File:JupyterLab_HomeTab.png|thumb|Default home tab when JupyterLab is loaded]]


=== Menu bar on top ===
=== Menu bar on top === <!--T:6-->
* In the ''File'' menu:
* In the ''File'' menu:
** ''Hub Control Panel'': if you want to manually stop the JupyterLab server and the corresponding job on the cluster. This is useful when you want to start a new JupyterLab server with more or less resources
** ''Hub Control Panel'': if you want to manually stop the JupyterLab server and the corresponding job on the cluster. This is useful when you want to start a new JupyterLab server with more or less resources
Line 26: Line 28:
* Most other menu items are related to notebooks and Jupyter applications
* Most other menu items are related to notebooks and Jupyter applications


=== Tool selector on left ===
=== Tool selector on left === <!--T:7-->
* ''File Browser'' (folder icon):
* ''File Browser'' (folder icon):
** This is where you can browse in your home, project and scratch spaces
** This is where you can browse in your home, project and scratch spaces
Line 44: Line 46:
** The last sub-panel is the list of ''Available modules'', similar to the output of <code>module avail</code>. By clicking on a module's name, detailed information about the module is displayed. By clicking on the ''Load'' link, the module will be loaded.
** The last sub-panel is the list of ''Available modules'', similar to the output of <code>module avail</code>. By clicking on a module's name, detailed information about the module is displayed. By clicking on the ''Load'' link, the module will be loaded.


=== Application area on right ===
=== Application area on right === <!--T:8-->
* The ''Launcher'' tab is opened by default
* The ''Launcher'' tab is opened by default
** It contains all available [[#Jupyter_Applications|Jupyter applications and notebooks]], depending on which modules are loaded
** It contains all available [[#Jupyter_Applications|Jupyter applications and notebooks]], depending on which modules are loaded


=== Status bar at the bottom ===
=== Status bar at the bottom === <!--T:9-->
* By clicking on the icons, this brings you to the ''Running Terminals and Kernels'' tool.
* By clicking on the icons, this brings you to the ''Running Terminals and Kernels'' tool.


== Jupyter Applications ==
== Jupyter Applications == <!--T:10-->


<!--T:11-->
JupyterLab offers access to a terminal, an IDE (Desktop), a Python console and different options to create text and Markdown files. This section presents only the main supported Jupyter applications that work with the Compute Canada software stack.
JupyterLab offers access to a terminal, an IDE (Desktop), a Python console and different options to create text and Markdown files. This section presents only the main supported Jupyter applications that work with the Compute Canada software stack.


=== Terminal ===
=== Terminal === <!--T:12-->


<!--T:13-->
[[File:JupyterLab_Launcher_Terminal.png|thumb|Terminal launcher button]]
[[File:JupyterLab_Launcher_Terminal.png|thumb|Terminal launcher button]]
This launcher will open a terminal in a new JupyterLab tab:
This launcher will open a terminal in a new JupyterLab tab:
Line 67: Line 71:
** Paste operation: press Ctrl+V
** Paste operation: press Ctrl+V


=== Python 3.x (notebook) ===
=== Python 3.x (notebook) === <!--T:14-->


<!--T:15-->
[[File:JupyterLab_Softwares_ScipyStack.png|thumb|Searching for scipy-stack modules]]
[[File:JupyterLab_Softwares_ScipyStack.png|thumb|Searching for scipy-stack modules]]
If any of the following scientific Python packages is required by your notebook, before you open this notebook, you must load the <code>scipy-stack</code> module from the JupyterLab ''Softwares'' tool:
If any of the following scientific Python packages is required by your notebook, before you open this notebook, you must load the <code>scipy-stack</code> module from the JupyterLab ''Softwares'' tool:
Line 79: Line 84:
* And many more (click on the <code>scipy-stack</code> module to see all ''Included extensions'')
* And many more (click on the <code>scipy-stack</code> module to see all ''Included extensions'')


<!--T:16-->
To open an existing Python notebook:
To open an existing Python notebook:
* Go back to the ''File Browser''
* Go back to the ''File Browser''
Line 86: Line 92:
** An IPython kernel will start running in background for this notebook
** An IPython kernel will start running in background for this notebook


<!--T:17-->
To open a new Python notebook in the current ''File Browser'' directory:
To open a new Python notebook in the current ''File Browser'' directory:
* Click on the ''Python 3.x'' launcher under the ''Notebook'' section:
* Click on the ''Python 3.x'' launcher under the ''Notebook'' section:
Line 91: Line 98:
** A new IPython kernel will start running in background for this notebook
** A new IPython kernel will start running in background for this notebook


=== OpenRefine ===
=== OpenRefine === <!--T:18-->


=== RStudio ===
=== RStudio === <!--T:19-->


<!--T:20-->
[[File:JupyterLab_Launcher_RStudio.png|thumb|RStudio launcher button]]
[[File:JupyterLab_Launcher_RStudio.png|thumb|RStudio launcher button]]
To enable the ''RStudio'' launcher, the following three modules need to be loaded:
To enable the ''RStudio'' launcher, the following three modules need to be loaded:
Line 101: Line 109:
# <code>rstudio-server</code>
# <code>rstudio-server</code>


<!--T:21-->
Depending on the software environment version, you should load the following two modules (<code>r</code> is loaded automatically):
Depending on the software environment version, you should load the following two modules (<code>r</code> is loaded automatically):
* With <code>StdEnv/2020</code>, it is not yet working
* With <code>StdEnv/2020</code>, it is not yet working
Line 106: Line 115:
* With <code>StdEnv/2016.4</code>, load modules: <code>gcc/7.3.0</code>, <code>rstudio-server/1.2.1335</code>
* With <code>StdEnv/2016.4</code>, load modules: <code>gcc/7.3.0</code>, <code>rstudio-server/1.2.1335</code>


<!--T:22-->
This ''RStudio'' launcher will open or reopen an RStudio interface in a new Web browser tab:
This ''RStudio'' launcher will open or reopen an RStudio interface in a new Web browser tab:
* It is possible to reopen an active RStudio session after the Web browser tab was closed
* It is possible to reopen an active RStudio session after the Web browser tab was closed
* The RStudio session will end when the JupyterLab session will end
* The RStudio session will end when the JupyterLab session will end


=== VS Code ===
=== VS Code === <!--T:23-->


=== Desktop ===
=== Desktop === <!--T:24-->


<!--T:25-->
[[File:JupyterLab_Launcher_Desktop.png|thumb|Desktop launcher button]]
[[File:JupyterLab_Launcher_Desktop.png|thumb|Desktop launcher button]]
This ''Desktop'' launcher will open or reopen a remote Linux desktop interface in a new Web browser tab:
This ''Desktop'' launcher will open or reopen a remote Linux desktop interface in a new Web browser tab:

Revision as of 19:15, 11 January 2021


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.



Other languages:

Introduction

JupyterLab is now the recommended general-purpose user interface to use on a JupyterHub. From a JupyterLab server, you can manage your remote files and folders, and you can launch Jupyter applications like a terminal, (Python 3) notebooks, RStudio and a Linux desktop.

The subsection JupyterHub on clusters contains the list of available Jupyter hubs at Compute Canada.

Launching a JupyterLab server as a job

Server Options form on Béluga's JupyterHub

On Béluga and Hélios, once the authentication is done on JupyterHub, your Web browser is redirected to either a) a previously launched Jupyter server or b) a form that allows you to configure and submit a new interactive session on the cluster. In any case, the JupyterLab server is running on dedicated compute resources.

In the Server Options form, you can:

The JupyterLab Interface

When JupyterLab is ready to be used, the interface has multiple panels.

Default home tab when JupyterLab is loaded

Menu bar on top

  • In the File menu:
    • Hub Control Panel: if you want to manually stop the JupyterLab server and the corresponding job on the cluster. This is useful when you want to start a new JupyterLab server with more or less resources
    • Log Out: the JupyterHub session will end, which will also stop the JupyterLab server and the corresponding job on the cluster
  • Most other menu items are related to notebooks and Jupyter applications

Tool selector on left

  • File Browser (folder icon):
    • This is where you can browse in your home, project and scratch spaces
    • It is also possible to upload files
  • Running Terminals and Kernels:
    • To stop kernel sessions and terminal sessions
  • Commands
  • Property Inspector
  • Open Tabs:
    • To navigate between application tabs
    • To close application tabs - the corresponding kernels remain active
Loaded modules and available modules
  • Softwares (blue cubic icon):
    • Compute Canada modules can be loaded and unloaded in the JupyterLab session
    • The search box can search for available modules and give the result in the Available Modules panel. Note: some modules are hidden until their dependency is loaded - we recommend that you first look for a specific module with module spider module_name from a terminal.
    • The next sub-panel is the list of Loaded Modules in the whole JupyterLab session. Note: while python and ipython-kernel modules are loaded by default, additional modules must be loaded before launching some other applications and notebooks. For example: scipy-stack.
    • The last sub-panel is the list of Available modules, similar to the output of module avail. By clicking on a module's name, detailed information about the module is displayed. By clicking on the Load link, the module will be loaded.

Application area on right

Status bar at the bottom

  • By clicking on the icons, this brings you to the Running Terminals and Kernels tool.

Jupyter Applications

JupyterLab offers access to a terminal, an IDE (Desktop), a Python console and different options to create text and Markdown files. This section presents only the main supported Jupyter applications that work with the Compute Canada software stack.

Terminal

Terminal launcher button

This launcher will open a terminal in a new JupyterLab tab:

  • The terminal runs a (Bash) shell on the remote compute node without the need of an SSH connection
    • Gives access to the remote filesystems (/home, /project, /scratch)
    • Allows running compute tasks
  • The terminal allows copy-and-paste operations of text:
    • Copy operation: select the text, then press Ctrl+C
      • Note: usually, Ctrl+C is used to send a SIGINT signal to a running process, or to cancel the current command. To get this behaviour in JupyterLab's terminal, click on the terminal to deselect any text before pressing Ctrl+C
    • Paste operation: press Ctrl+V

Python 3.x (notebook)

Searching for scipy-stack modules

If any of the following scientific Python packages is required by your notebook, before you open this notebook, you must load the scipy-stack module from the JupyterLab Softwares tool:

  • ipython, ipython_genutils, ipykernel, ipyparallel
  • matplotlib
  • numpy
  • pandas
  • scipy
  • Other notable packages: Cycler, futures, jupyter_client, jupyter_core, mpmath, pathlib2, pexpect, pickleshare, ptyprocess, pyzmq, simplegeneric, sympy, tornado, traitlets
  • And many more (click on the scipy-stack module to see all Included extensions)

To open an existing Python notebook:

  • Go back to the File Browser
  • Browse to the location of the *.ipynb file
  • Double-click on the *.ipynb file:
    • This will open the Python notebook in a new JupyterLab tab
    • An IPython kernel will start running in background for this notebook

To open a new Python notebook in the current File Browser directory:

  • Click on the Python 3.x launcher under the Notebook section:
    • This will open a new Python 3 notebook in a new JupyterLab tab
    • A new IPython kernel will start running in background for this notebook

OpenRefine

RStudio

RStudio launcher button

To enable the RStudio launcher, the following three modules need to be loaded:

  1. gcc
  2. r
  3. rstudio-server

Depending on the software environment version, you should load the following two modules (r is loaded automatically):

  • With StdEnv/2020, it is not yet working
  • With StdEnv/2018.3, load modules: gcc/7.3.0, rstudio-server/1.2.1335
  • With StdEnv/2016.4, load modules: gcc/7.3.0, rstudio-server/1.2.1335

This RStudio launcher will open or reopen an RStudio interface in a new Web browser tab:

  • It is possible to reopen an active RStudio session after the Web browser tab was closed
  • The RStudio session will end when the JupyterLab session will end

VS Code

Desktop

Desktop launcher button

This Desktop launcher will open or reopen a remote Linux desktop interface in a new Web browser tab:

  • This is equivalent to running a VNC server on a compute node, then creating an SSH tunnel and finally using a VNC client, but you need nothing of all this with JupyterLab!
  • It is possible to reopen an active desktop session after the Web browser tab was closed
  • The desktop session will end when the JupyterLab session will end