Jupyter Lab: Evolution of the Jupyter Notebook

Jupyter Lab: Evolution of the Jupyter NotebookParul PandeyBlockedUnblockFollowFollowingFeb 22All good things (must) come to an end to make way for something better.

Data says there are more than three million Jupyter Notebooks available publicly on Github.

There is roughly a similar number of private ones too.

Even without this data, we are quite aware of the popularity of the notebooks in the Data Science domain.

The possibility of writing codes, inspecting the results, getting rich outputs are some of the features that really made Jupyter Notebooks very popular.

But as it is said that all good things (must) come to an end, so will our favourite Notebook too.

JupyterLab will eventually replace the classic Jupyter Notebook but for good.

Jupyter LabSourceJupyterLab is the next-generation user interface for Project Jupyter offering all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.

) in a flexible and a more powerful user interface.

The basic idea of the Jupyter Lab is to bring all the building blocks that are in the classic notebook, plus some new stuff, under one roof.

Table of ContentsInstallationInterfaceCreating and Saving FilesFlexible LayoutsEnhanced Notebook FunctionalitySupported File FormatsInteractive ComputingExtensionsConclusionIn case you are completely unfamiliar with Jupyter Lab, you can start reading the article right from Intallation.

But if you have already worked with them and want an advanced overview, skip the first four parts and jump straight to part 5 making sure that you are using the latest release.


InstallationJupyterLab can be installed using conda, pip or pipenv.

#condaconda install -c conda-forge jupyterlab#pippip install jupyterlab#pipenvpipenv install jupyterlabpipenv shellHave a look at the official installation documentation for more details.

Starting JupyterLabYou can start the Jupyter by simply typing the following at the console:jupyter labJupyterLab will open automatically in the browser with an interface resembling the one below.

This means everything is in place and you are good to go.

Since I use both Python and R in Jupyter Lab, my worksheet has icons for both of them.


InterfaceLet’s understand a bit about the interface before working with its various functionalities.

Menu BarThe Menu Bar has the top-level menus that showcase the various actions that are available in Jupyter Lab.

Left SidebarThis consists of the commonly-used tabs.

The left sidebar can be collapsed or expanded by selecting Show Left Sidebar in the View menu or by clicking on the active sidebar tab.

You can view the running session from the Running palette while the Commands palette lets you search for all the commands that are available.

Main Work AreaThis is the area where the actual activity takes place.

It comprises of the notebooks, documents, consoles, terminals etc.

Just double click or drag a file on to this area to start working.

Workspaces can be saved on the server with named workspace URLs.

Also, you can switch between the classic Notebook view and the JupyterLab view by changing the lab to tree in the url of the Jupyter Lab.


Creating and Saving FilesIn this section, we will quickly see how to work with files in Jupyter Lab.

Creating FilesSimply click on the + icon in the main menu.

This opens a new Launcher tab in the main work area could enabling us to create a Notebook, Console, terminal or text editor.

The same action can also be achieved by using the File tab.

Once opened, the files can be renamed and even downloaded.

Opening Existing FilesOpening files is a very straightforward process.

Either double click on them or access them through the upper File Tab.

????These were just the basics of Jupyter Lab , essentially to get started.

Now let’s move on to the part where we discuss its real capabilities and what makes it superior to classic Notebooks.


Flexible LayoutsThe classic Jupyter Notebook also supports an inbuilt Text Editor and a Terminal but these options aren’t used much since they are mostly hidden from sight.

Another reason is that all these components work as standalone features and not integrated.

Different blocks in a classic Network which worked independentlyJupyter Lab tends to plug this pain area by integrating all the features into a single interactive and collaborative environment.

NotebooksThe notebook document format used in JupyterLab is the same as in the classic Jupyter Notebook.

The existing notebooks should open correctly in JupyterLab and we can do our regular analysis in there.

ConsoleThere are consoles for people who are used to a QT console type environment.

These consoles enable us to run code interactively in a kernel.

Text EditorThe text editor makes it possible to edit the files.

The text editor includes syntax highlighting, configurable indentation (tabs or spaces), key maps and basic theming.

These settings can be found in the Settings menu.

TerminalJupyterLab terminal provides full support for system shells (bash, tsch, etc.

) on Mac/Linux and PowerShell on Windows.

We can run anything in our system shell with a terminal, including programs such as vim or emacs.

Now, one would say that all these features were present in the classic notebook too so what makes Jupyter Lab different.

The fact that it gives us a very flexible layout system which allows us to take these tabs, drag them side-by-side and resize them with almost unlimited flexibility is something that was missing earlier.


Enhanced Notebook FunctionalityJupyter lab is not a reimplementation of the notebook format but just a new front-end that exists on top of all of the existing architecture.

However, this new front end implementation has made it possible to include features that we missed in the classic notebooks.

Some of the features are:Expand and Collapse cellsDrag and Drop cells within the NotebookTab Autocompletion in the EditorThe text editors now have the code autocompletion feature.

However, as of now, it is only enabled when there is an attached console to the text editor.

ThemesThere are themes available for the JupyterLab as a whole and for the Text Editors as well.


Supported File FormatsJupyter Lab also supports other formats like :Images: jpeg, png etc and GifsgeojsonVegalite files, geojson files,PDF DocumentsHigh-Performance CSV viewerA Jupyter Lab can basically render arbitrarily large CSVs s which are typically rendered as unresponsive in Excel.

It is not very interactive as yet but some improvements may be expected soon.


Interactive ComputingThe real capabilities of Jupyter Lie in the fact that it supports interactive computing which is very useful in Data Science particularly.

Creating New View for OutputI’ll be using the Lorenz differential equations notebook from the official Jupyter Github page.

After running a few cells, we get the interactive Lorenz attractor as the output.

Sometimes when we have an interactive output, it gets kind of frustrating having to scroll up and down to the code that generates it.

As a solution to this problem, Jupyter Lab gives us an option to break the output into a new tab and we have a kind of pseudo dashboard where we can use the sliders and change the parameters.

New View on the same fileSometimes our notebook is too long and so we can have two views of the same(or different) notebooks in a single instance.

This could be useful when we want to look at the top and bottom of the notebook at the same time.

Dragging / Dropping and Editing Cells between NotebooksWe know the cells can be dragged within a notebook.

However, the cells can also be dragged across different Notebooks.

Also, the changes in one Notebook is reflected into the other as well.

Simplifying the Code Documentation ProcessIt is rightly said that Code is read more often than it is written.

Documentation is a very important aspect of programming and Jupyter Lab tends to make it easier.

One of the problems that I really face when writing documentation in a markdown file is that I have to run the code in a different console to check if it is running perfectly and then include it in the file.

Switching tabs, again and again, is annoying.

Jupyter Labs lets you combine the editor and console into a single view.

So you can check your code and your documentation and preview the entire file at the same time.


ExtensionsJupyterLab has been designed as an essentially extensible environment.

The extensions are really powerful tools that can really enhance a person’s productivity.

JupyterLab extensions are npm packages (the standard package format in Javascript development).

There are many community-developed extensions being built on GitHub.

You can search for the GitHub topic jupyterlab-extension to find extensions.

In order to install JupyterLab extensions, you need to have Node.

js installed which can either be installed from their website or as follows.

conda install -c conda-forge nodejsorbrew install nodeInstalling ExtensionsNew extensions can be installed by using the following command:jupyter labextension install <my-extension>where where my-extension is the name of a valid JupyterLab extension npm package on npm.

Use the my-extension@version syntax to install a specific version of an extension, for example:jupyter labextension install my-extension@1.


3For more details, please refer to the official documentation on extensions.

Let’s talk about a few extensions which I use a lot and are really powerful:Google Drive ExtensionThis extension adds a Google Drive file browser to the left side panel of JupyterLab.

When you are logged into your Google account, you will have the files stored in it available to JupyterLab.

Installationjupyter labextension install @jupyterlab/google-driveApart from installing the extension, you will also have to authenticate your JupyterLab deployment with Google.

Go through the setup file or the link here for the process.

You will get a client ID which you will have to manually enter.

sourceUsageNow, if someone shares a notebook or a markdown file, it will reflect in the shared with me folder in Jupyter Lab.

We can open and edit it there itself.

Github ExtensionIt is a JupyterLab extension for accessing GitHub repositories.

This extension allows us to select GitHub organizations and users, browse their repositories, and open the files in those repositories.

If those files are notebooks, we can run them just as we would run any other notebook.

Installationjupyter labextension install @jupyterlab/githubAfter installation, we need to get the credentials from GitHub.

For more details please read the instructions here.

UsageGit Extensionjupyterlab-git is a JupyterLab extension for version control using git.

InstallationTo install perform the following steps:jupyter labextension install @jupyterlab/gitpip install jupyterlab-gitjupyter serverextension enable –py jupyterlab_gitUsageDrawio PluginDrawio plugin is a JupyterLab extension for standalone integration of drawio into Jupyterlab.


io is a free online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams.

Installationjupyter labextension install jupyterlab-drawioUsageThese extensions really make the JupyterLab stand out.

Having all the tools in a single workplace makes it very useful since one doesn’t have to switch between different environments to get the things done.

Apart from the above extensions there are many others and feel free to try them out too.

????ConclusionJupyterLab is truly the next-generation web-based user interface.

It is loaded with tools for interactive computing and well-designed interface that allows users to combine them in novel ways.

It is really powerful and provides a great variety of robust tools which will make the Data Analysis process much smoother and definitely more productive.


. More details

Leave a Reply