ModuleNotFoundError: No module named 'jupyterlab' when starting JupyterLab
ModuleNotFoundError: 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.
Fix it fast
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__)"2Match what you see, then jump to its fix
- 1
The import in the first step fails with the same ModuleNotFoundErrorJupyterLab is not installed in this environmentFix - 2
JupyterLab was installed with pipenv or a venv, but the command runs outside itThe project's virtual environment is not activeFix - 3
pip install --user succeeded, but jupyter or the module is not found by the shellA user-level install is not on PATHFix
- 1
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 jupyterlab2Fix
Install JupyterLab with pip into the active environment.
pip install jupyterlab3Verify
Start it.
jupyter labConfirmed by jupyterlab.readthedocs.io
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_ENV2Fix
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 lab3Verify
The launch now finds the module.
jupyter lab --versionConfirmed by jupyterlab.readthedocs.io
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/bin2Fix
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 labConfirmed by jupyterlab.readthedocs.io
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:
- stegnor.comMy company site: 804 pages from a Python and Jinja generator, with 15 free browser tools.
- MenuloA restaurant discovery platform in Germany, kept current by a Python ingestion pipeline.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Servers
pip install worked but the jupyter command is not found
bash: jupyter: command not found
The shell can only run programs that sit in a folder on PATH.
2 causes, each with a fixServers
pip install confluent-kafka fails because librdkafka/rdkafka.h is missing
pip stops while building confluent-kafka from source
The error means pip is compiling confluent-kafka from source, and the compiler cannot find the librdkafka C headers.
3 causes, each with a fixServers
cv2.imshow raises 'not implemented' because the wrong OpenCV package is installed
cv2.imshow() works in one environment and fails in another
The headless OpenCV packages are built without any GUI code, so cv2.imshow cannot open a window.
2 causes, each with a fixServers
pip install Cython succeeded, but the shell cannot find cythonize
a pip warning that a script was installed to a directory outside PATH
pip put the cythonize script in a folder your shell does not search.
3 causes, each with a fixServers
Django returns a 500 behind Gunicorn and the traceback is nowhere
The traceback shows locally with runserver but not under Gunicorn
With DEBUG set to False, Django's default logging does not print errors to the console.
2 causes, each with a fixServers
Docker build fails with apk: not found in a Python or Ubuntu image
/bin/sh: 1: apk: not found
apk is the package manager of Alpine Linux only.
2 causes, each with a fix