JupyterLab: Run a fresh instance in 1 minute (= 3 commands)

Oct 4, 2021 14:25 ยท 149 words ยท 1 minute read

JupyterLab is a great way to interactively play around with Python, e.g. when doing data science, i.e. examining a data set. Here is my favorite way to install it. Main advantage in my opinion: This type of installation does not install JupyterLab globally, but scoped to a specific folder.

Prerequisites

  • Python 3.x (is installed by default on Ubuntu/Debian and macOS)
  • The awesome Poetry Python package manager. See Installation Docs. Installation is a one-line command ๐Ÿ˜Ž

Commands

  1. poetry init --no-interaction: Initialize a new empty Poetry project
  2. poetry add jupyterlab: Install JupyterLab in a separate virtual environment (does not clash with your existing installed Python packages)
  3. poetry run jupyter-lab: Run JupyterLab => you will receive an URL under which you can visit & use the running instance.

Boom, you’re done! ๐ŸŽ‰

In the future, you can run JupyterLab from this folder by simply running the last command, poetry run jupyter-lab. ๐Ÿš€