Maaz Zindani

Loading the index…

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

pip install worked but the jupyter command is not found

Errorjupyter: command not found

Short answer

The shell can only run programs that sit in a folder on PATH. pip puts the jupyter script in ~/.local/bin for a user install, or in the bin folder of a virtual environment. If that folder is not on PATH, or the environment is not active, the command is not found. Add the folder or activate the environment.

  • Applies to Python 3.12, pip 24, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the folder where user-installed scripts land and compare it with your PATH. If the folder is missing from PATH, the first cause applies. If you work in a virtual environment, check the second.

    python3 -c "import sysconfig; print(sysconfig.get_path('scripts', 'posix_user'))"
    echo "$PATH"
  2. 2Match what you see, then jump to its fix

    1. 1pip installed into the user site (a --user install, or pip did it after a permission error) and the scripts folder is missing from echo $PATHThe user scripts folder is not on PATHFix
    2. 2The package is listed by that environment's python -m pip, but a fresh terminal does not find the commandIt was installed into a virtual environment that is not activeFix

What does the error look like?

  • jupyter: command not found
  • bash: jupyter: command not found

Cause 1 of 2

The user scripts folder is not on PATH

1Check

For the user installation scheme on Linux, scripts go to USER_BASE/bin, and USER_BASE defaults to ~/.local. Confirm the script is there.

python3 -m site --user-base
ls ~/.local/bin | grep jupyter

2Fix

Add that bin folder to PATH in your shell profile, then open a new terminal.

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile
. ~/.profile

3Verify

The shell now finds the command.

command -v jupyter
jupyter lab

Confirmed by docs.python.org

Did this fix it?

Cause 2 of 2

It was installed into a virtual environment that is not active

1Check

A virtual environment keeps its scripts in its own bin folder, and activating it puts that folder first on PATH. In a terminal where it is not active, the script is invisible.

ls .venv/bin | grep jupyter
echo "$VIRTUAL_ENV"

2Fix

Activate the environment before running jupyter, or call the script by its full path. Install with python -m pip so the package goes to the interpreter you are using.

source .venv/bin/activate
python -m pip install notebook
jupyter notebook

3Verify

With the environment active, the command resolves inside it.

command -v jupyter

Confirmed by docs.python.org

Did this fix it?

How do I stop it coming back?

  • Use python -m pip install, so pip and python are always the same interpreter (pip documentation).
  • Create one virtual environment per project and activate it in every terminal you use for that project.
  • Install JupyterLab or Notebook with pip install jupyterlab or pip install notebook, as the Jupyter install page shows.

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.