DEV Community 👩‍💻👨‍💻

Todd Birchard for Hackers And Slackers

Posted on • Originally published at hackersandslackers.com on

Upgrading to JupyterLab on Ubuntu

Upgrading to JupyterLab on Ubuntu

Last we chatted, we walked through the process of getting started with Jupyter notebooks on a Ubuntu server. The classic Jupyter notebook interface is certainly well-suited to the job done. That said, it only takes some time of getting lost in the interface to start thinking we can do better. That's where Jupyter Lab comes in.

Why JupyterLab?

JupyterLab is sometimes referred to as "the next generation of Jupyter notebooks," which is a statement I can attest to. JupyterLab offers an improved interface for Jupyter notebooks which is both available out of the box, as well as highly customizable for your workflow.

Out of the box, the traditional Jupyter interface is extended to include a tree file manager: similar to what you might expect from an IDE. This allows you to easily browse all available notebooks on your server. In addition, the notebook interface has been simplified to reduce noise brought on by (mostly useless) toolbars and excessive buttons. Take a look at the interface prior to any customization:

Upgrading to JupyterLab on Ubuntu

Even more appealing than an updated interface is JupyterLab's openness to customization. JupyterLab has a strongly growing ecosystem for extension development: we'll be getting a taste of some of those goodies in just a moment.

Getting Started

If you're starting from scratch, go ahead and follow the same steps in the Jupyter Notebook setup tutorial up until Conda is set up and activated.

With a Ubuntu server prepped and ready, install Jupyter Lab with the following command:

$ conda install -c conda-forge jupyterlab

Before we go any further, make sure you're tunneled into your server - we need to do this in order to launch notebooks, remember?:

$ ssh -L 8888:localhost:8888 myuser@your_server_ip

Start up the Jupyter Lab environment like this:

$ conda activate your_env
$ jupyter lab

If everything went well, you should be greeted with a fancy Jupyter Lab loading screen and then thrown into the Jupyer Lab environment.

Upgrading to JupyterLab on Ubuntu

Home sweet home.

Things are looking good right off the bat. Without any added libraries, we've already beefed up our Jupyter Notebook workspace. The tree view is available, we can launch terminals, and don't forget: we can split screen by dragging snapping windows where we see fit.

Customizing Your Workspace

JupyterLab uses NodeJS to enable some of its cooler functionality and extensions. Go ahead and install Node:

$ cd /tmp
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Nice! Now we have all we need to go nuts with extensions. Here are the ones I recommend:

Status Bar


<!--kg-card-end: hr--><!--kg-card-begin: image-->

Upgrading to JupyterLab on Ubuntu

Keep an eye on your environment's vitals.

Repository found here. Installation steps:

$ pip install nbresuse
$ jupyter serverextension enable --py nbresuse
$ jupyter labextension install @jupyterlab/statusbar

Table of Contents

Upgrading to JupyterLab on Ubuntu

Auto-generate table of contents to help navigate and organize your notebooks.

Repository found here. Installation steps:

$ jupyter labextension install @jupyterlab/toc

Variable Inspector


<!--kg-card-end: hr--><!--kg-card-begin: image-->

Upgrading to JupyterLab on Ubuntu

Keep tabs on every variable used in your notebook and their respective values.

Repository found here. Installation steps:

$ jupyter labextension install @lckr/jupyterlab_variableinspector

Git Integration


<!--kg-card-end: hr--><!--kg-card-begin: image-->

Upgrading to JupyterLab on Ubuntu

A visual approach to version control.

Repository found here. Installation steps:

$ jupyter labextension install @jupyterlab/git
$ pip install jupyterlab-git
$ jupyter serverextension enable --py jupyterlab_git

Draw.io


<!--kg-card-end: hr--><!--kg-card-begin: image-->

Upgrading to JupyterLab on Ubuntu

Create Draw.io diagrams right from your notebook.

Repository found here. Installation steps:

$ jupyter labextension install jupyterlab-drawio

Additional Resources

You have everything you need to go nuts from here forward. INSTALL ALL THE EXTENSIONS!

If you're looking for more extension goodness, I'd start with the Awesome Jupyter repo on Github- there's a section specifically for JupyterLab.

If you're totally into JupyterLab now and want to join a gang, the community page can be found here.

Lastly, if you've gone totally off the deep end and already want to start creating extensions of your own, check out the extension documentation. That's all folks!

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠