- This topic has 0 replies, 1 voice, and was last updated 3 months, 1 week ago by Oluwole.
February 21, 2020 at 4:56 pm #86410Participant@oluwole
JupyterLab is a next-gen web-based IDE that supports over 100 programming languages (referred to as kernels) including Python, R, Java, Julia, Matlab, Scala and many more. It is an upgrade on the old Jupyter Notebook as it comes with additional features such as an extensible environment.
From the installation to their usage, this post will teach you how to manage extensions in JupyterLab.
What are JupyterLab Extensions?
JupyterLab Extensions are NPM packages that allow for the customisation and enhancement of any part of JupyerLab. Generally, JupyterLab Extensions can provide;
- APIs for use by other extensions
- Additional items to the command or menu palette, keyboard shortcuts, or settings system
- New file viewers and editors, new themes and renderers for rich output in notebooks.
One way to be assured of the safety of an extension is to verify if the JupyterLab organisation released it. We will see how to do so subsequently.
Let’s get started!
Installation of JupyterLab and Node.js
If you are yet to install JupyterLab, this guide to setting up the JupyterLab environment will help you do just that.
After installing JupyterLab, you will need to have Node.js installed. Node.js is needed simply because it helps to rebuild and link all the dependencies in the JupyterLab environment. Here is how to get it installed;
conda, you can easily get it done with;
conda install -c conda-forge nodejs
It takes a while, and you need a strong and stable internet connection. After successful installation, you can confirm the status by running this in your
As seen below, it returns information on the version number installed. In my case it is v12.15.0.
Enabling the Extension Manager
The extension manager in the JupyterLab environment helps you easily install, uninstall, enable and disable extensions. To access it, you can either search for extension manager in the command palette as shown below or scroll down the command palette tab.
Click on Enable Extension Manager (experimental), and you should see a confirmation prompt asking if you want to enable the extension manager and stating a disclaimer that some extensions might pose a security risk.
Click on Enable, and a new tab called Extension Manager should appear in the left sidebar.
Available extensions can be found using the Discovery section in the Extension Manager. Clicking on the dropdown triggers a list of all the JupyterLab Extensions in the NPM registry. You can also use the search bar to fine-tune your discovery by entering the name of your desired extension.
These packages are sorted such that the best ones are shown first. This ranking is done according to the following parameters:
- Popularity– indicates how many times a package has been downloaded. Very popular extensions have been found useful by lots of people.
- Quality – this ranks the extensions based on the presence of a README file, current dependencies, custom website, stability, tests, and code complexity.
- Maintenance – This indicates the amount of attention the package gets from developers.
- Optimal – this combines the criteria mentioned above (maintenance, quality and popularity) into a single rating.
Therefore the odds are that the first sets of extensions you see whenever you search would be popular, of good quality and adequately maintained.
Say we want to install the JupyterLab draw.io extension, a useful diagramming application which is free and tightly integrated with Google Drive.
We start by searching for the extension in the search bar;
As earlier stated, one must be careful only to install trusted extensions. Extensions released by the JupyterLab organisation have a Jupyter icon next to their name.
We can see, therefore, that the JupyterLab draw.io extension was not released by JupyterLab organisation. It can, however, be trusted.
Next, we click on Install to have the draw.io extension installed. This installation takes a while, and the blue bar just below the search bar indicates that the installation is in progress.
A short while after installation, note that a drop-down appears indicating that the download has been completed, but that a rebuild is needed to finalise the installation.
If you intend to install or uninstall other extensions, you can ignore the rebuild until you are done making the changes you desire. When you are satisfied, click on Rebuild to start a rebuild in the background. If you click on Ignore by mistake, no problem. Refresh your browser tab to trigger a new rebuild check.
During the rebuild process, again you see the blue bar just below the search bar, and also there is some activity in your
Once the rebuild is done, a dialogue pops up indicating that you need to reload the page to load the latest build into the browser. Click on Reload to finalise the installation process and the extension should appear in the Installed section of the extension manager with the options to Uninstall or Disable it.
Using the Extension
Before installing the extension, the Other tab in the launcher looked like this:
After installation, notice the new Diagram option;
Clicking on it opens a new diagram file in a new window in your JupyterLab environment. You can now make diagrammatical representations as you please.
Disabling and Uninstalling Extensions
Disabling an extension prevents the extension from loading in the browser and activating. This does not require any rebuilding as the extension is still present in JupyterLab. Uninstalling the extension, however, completely removes the package, and a rebuild is usually necessary.
You can think of disabling the extension as putting it in storage, and enabling it brings it out of storage. Uninstalling is more like throwing the extension in a bin. Both options are available for every installed extension in the Extension Manager tab.
We disable the JupyterLab-drawio extension by clicking on Disable. You will need to restart JupyterLab for this change to be effected, and you’d realise that the Diagrams icon is non-existent in the Launcher.
We can also see that the extension is still listed under the Installed section of the extension manager.
Uninstalling the extension is done similarly – by clicking on Uninstall. This will require a rebuild and a restart. The extension will no longer be listed under the Installed column.
In this guide, we have seen how to manage JupyterLab Extensions using the Extension Manager. Our sample scenario involved the JupyterLab Drawio extension. We learnt how to find, install, open, disable, and uninstall the extension. Although other extensions have different functionalities, they can be managed in a similar way.
You must be logged in to reply to this topic.