Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

ModuleNotFoundError: No module named 'jupyterlab' when starting JupyterLab

ErrorModuleNotFoundError: No module named 'jupyterlab'

Short answer

Python says it cannot find jupyterlab because the interpreter that runs the command does not have the package. Ask that interpreter directly, then install JupyterLab into the environment you launch from, activate the right virtual environment first, or put the user-level bin folder on PATH.

  • Applies to JupyterLab 4, Python 3.12, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Ask the same Python that raised the error whether it can see the package, and which file it is.

    which python3
    python3 -c "import jupyterlab, sys; print(jupyterlab.__file__)"
  2. 2Match what you see, then jump to its fix

    1. 1The import in the first step fails with the same ModuleNotFoundErrorJupyterLab is not installed in this environmentFix
    2. 2JupyterLab was installed with pipenv or a venv, but the command runs outside itThe project's virtual environment is not activeFix
    3. 3pip install --user succeeded, but jupyter or the module is not found by the shellA user-level install is not on PATHFix

What does the error look like?

  • ModuleNotFoundError: No module named 'jupyterlab'

Cause 1 of 3

JupyterLab is not installed in this environment

1Check

List the installed packages of the interpreter in use.

python3 -m pip list | grep -i jupyterlab

2Fix

Install JupyterLab with pip into the active environment.

pip install jupyterlab

3Verify

Start it.

jupyter lab

Confirmed by jupyterlab.readthedocs.io

Did this fix it?

Cause 2 of 3

The project's virtual environment is not active

1Check

Compare the interpreter path from the first step with the environment folder you installed into.

echo $VIRTUAL_ENV

2Fix

Activate the environment before launching. With pipenv, enter its shell or use pipenv run.

pipenv shell
jupyter lab
# or, in one line
pipenv run jupyter lab

3Verify

The launch now finds the module.

jupyter lab --version

Confirmed by jupyterlab.readthedocs.io

Did this fix it?

Cause 3 of 3

A user-level install is not on PATH

1Check

A user install puts scripts in ~/.local/bin, which may not be on PATH.

echo $PATH | tr ':' '\n' | grep -n local/bin

2Fix

Add the user-level bin directory to PATH, in the shell startup file, so jupyter lab launches.

export PATH="$HOME/.local/bin:$PATH"

3Verify

Open a new terminal and launch it.

jupyter lab

Confirmed by jupyterlab.readthedocs.io

Did this fix it?

How do I stop it coming back?

  • Keep one virtual environment per project and install JupyterLab inside it.
  • Launch with python3 -m pip and python3 from the same environment so they always agree.
  • Note the environment name in the project README.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.