Installing and launching JupyterLab

Jupyter · Essentials · 8 min

Setting Jupyter up per project avoids the classic 'module not found in the notebook' confusion.

Jupyter has two main browser interfaces, both built on the same Jupyter Server:

  • JupyterLab: a full workspace with a file browser, tabs, side-by-side notebooks, terminals and extensions.
  • Jupyter Notebook 7: a simpler one-document-per-tab interface, built on JupyterLab components.

Install into the project's virtual environment so the notebook sees the same packages as your code:

python -m venv .venv && source .venv/bin/activate
pip install jupyterlab
jupyter lab

jupyter lab (or jupyter notebook) starts a local web server, usually on http://localhost:8888, and opens your browser with a URL containing a token, a password that protects the server. The directory you start from becomes the root of the file browser. Stop the server with Ctrl+C in the terminal, or File > Shut Down.

Three pieces are now running: the server process in your terminal, the browser page that is only a front end, and a kernel process per open notebook that executes the code. Closing the browser tab does not stop kernels; use the Running panel to shut them down.

Editors also speak Jupyter: VS Code, PyCharm and others open .ipynb files directly and start kernels without a separate server, and hosted services such as Google Colab run notebooks in the cloud. The file format and kernels are the same everywhere.

jupyter server list shows running servers and their URLs if you lose the tab.

Example

# Per-project setup
python -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install jupyterlab pandas

jupyter lab --version              # 4.6.x
jupyter lab                        # opens http://localhost:8888/lab?token=...
jupyter lab --no-browser --port 8890   # e.g. on a remote machine

# In another terminal
jupyter server list                # running servers with their token URLs

Remember

  • JupyterLab and Notebook 7 are front ends on the same Jupyter Server
  • Install Jupyter in the project environment, then run jupyter lab
  • Server, browser page and kernels are separate; closing a tab leaves kernels running

Watch out for

  • Installing Jupyter globally and the packages in a venv, so imports fail inside the notebook.

Check yourself

  1. You close the browser tab of a running notebook. What happens to its kernel?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: jupyterlab.readthedocs.io/en/stable/getting_started/installation.html