Skip to main content

Use Datalayer with JupyterLab

Datalayer integrates seamlessly as a JupyterLab extension, allowing you to manage and interact with Remote Kernels directly from your familiar JupyterLab interface. The extension mirrors the functionality available on Datalayer once you log in.

Installation

To install the Datalayer extension, ensure you have python>=3.9 and pip installed on your machine. Then, run the following command in your terminal:

# Use --upgrade if you want to update an existing installation to the latest version.
pip install datalayer jupyterlab

Start JupyterLab

Start JupyterLab as usual.

jupyter lab

You can provide traits to configure the server that delivers the Kernels as well as additional options for the display.

jupyter lab \
--DatalayerExtensionApp.run_url="https://oss.datalayer.run" \
--DatalayerExtensionApp.white_label=False \
--DatalayerExtensionApp.Launcher.category="GPU" \
--DatalayerExtensionApp.Launcher.name="GPU Kernels" \
--DatalayerExtensionApp.Launcher.icon_svg_url="https://raw.githubusercontent.com/datalayer/icons/main/svg/data2/circle-white.svg" \

The traits can be provided in a configuration as well, see the Jupyter common directories and file locations.

Datalayer Launcher

JupyterLab users are familiar with accessing the launcher, which displays various tiles for creating new Notebooks for example, as shown below.

Datalayer introduces a new section and tile at the top of the JupyterLab launcher. Click on the "Jupyter Kernels" tile to access the Datalayer UI.

Authentication

You can easily log in or sign up for Datalayer directly within the JupyterLab extension. Your account details are shared between the Datalayer website and the extension, ensuring a consistent and unified experience across both platforms.

Launch Remote Kernels

Refer to the Kernels section to learn how to launch Remote Kernels.

Use Remote Kernels

Assign a Remote Kernel to a Notebook

Once your Remote Kernel is up and running, you can change the kernel of any Notebook to a Remote Kernel by using the kernel picker located in the top-right corner of the Notebook interface. Simply assign a running remote kernel.

You can also launch a new remote kernel directly from the kernel picker by selecting an environment in the 'Assign a new kernel' section. You'll have the option to configure kernel settings, such as time reservation (see the Kernels page for more details).

Variables transfer

When you switch to a remote kernel, you have the option to transfer the variables from the current kernel to the new one. This feature is useful when you want to keep the state of your variables.

note

Variable transfers are currently limited to 7 MB. This limit is expected to increase in the future, and the option to add data to the remote environment will also be introduced.

Assign a Remote Kernel to a Cell

Datalayer allows you to selectively run specific cells on remote kernels. This hybrid approach optimizes both performance and cost by using remote resources only when necessary. Learn more about this feature in our blog post.

To assign a cell to a remote kernel, simply use the cell menu as shown below.

Variables transfer

You can also transfer variables between cells running on different kernels. This feature is particularly useful when you want to use variables you defined in previous cells.