pip install worked but the jupyter command is not found
jupyter: command not foundShort 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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
pip 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
The 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
- 1
What does the error look like?
jupyter: command not foundbash: 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 jupyter2Fix
Add that bin folder to PATH in your shell profile, then open a new terminal.
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile
. ~/.profile3Verify
The shell now finds the command.
command -v jupyter
jupyter labConfirmed by docs.python.org
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 notebook3Verify
With the environment active, the command resolves inside it.
command -v jupyterConfirmed by docs.python.org
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:
- 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
bash says Permission denied when you run a Python script directly
bash: ./script.py: Permission denied
Running ./script.py asks the kernel to execute the file, which needs the execute bit, a shebang line, a path you may enter, and a filesystem not mounted noexec.
4 causes, each with a fixServers
apt-get does not exist on this EC2 instance
sudo: apt-get: command not found
apt-get belongs to Debian and Ubuntu.
2 causes, each with a fixServers
bash warns that it cannot change the locale after you log in to a server
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
The shell was told to use a locale that is not built on the server.
3 causes, each with a fixServers
Syntax error: redirection unexpected when a Bash script runs under sh
script.sh: 12: Syntax error: redirection unexpected
The operators <<< (here-string) and &> are Bash features.
3 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 fix