Problem statement –
I have installed Jupyter notebook using pip but getting “jupyter command ‘jupyter-notebook’ not found” error, while trying to run it.
What is Jupyter Notebook?
Jupyter Notebook is a user-friendly software program for Data scientist or coders that blends coding and storytelling into one seamless experience. It’s like your digital playground for writing code, running it step by step, and sharing your analysis with others.
Some important features of Jupyter notebook –
- Interactive data analysis
- Reproducibility
- For education and learning
- Collaboration within team
- Integration with Libraries and Tools
Common Causes of “jupyter command ‘jupyter-notebook’ not found” error
As per my experience, following are the common causes of Jupyter command not found issue –
- Incorrect installation method or Version mismatch
- Pip not installed or misconfigured
- Environment variables are not set up correctly
- Virtual environments causing conflicts
Possible solutions –
- Install the Jupyter in recommended way and with compatible Python and Pip versions
- Fix environment variables or PATH related issues
Pre-requisites to fix the issue
- You must have compatible Python version installed on your computer. Jupyter installation requires Python 3.3 or greater, or Python 2.7 (already depreciated, not recommended). I would recommend to install the latest python version i.e. python 3.11.5, while writing this tutorial.
- For newbies, Package managers like pip or conda should already be installed which helps to install Jupyter and its dependencies automatically.
- Recommendation is to use virtual environment always for better package management.
Solution 1- How to fix jupyter command ‘jupyter-notebook’ not found
Below mentioned are the steps to fix Jupyter notebook command not found issues.
Step 1.1 – Check all the compatible versions and pre-requisites
- Check python version
python3 --version
- Check Pip version
pip --version
- Check Conda version, if you don’t use pip as package manager
conda --version
Check out my tutorial, if you get pip command not found error. I have written step by step installation and troubleshooting guides on pip, anaconda, python installation already.
Step 1.2 – Setup Virtual environment
- Set up virtual environment for Linux or macOS
If you haven’t already created and activated a virtual environment, you can do so using venv
(built-in to Python 3) or virtualenv
(a third-party package). Replace myenv
with your preferred environment name.
- Using
venv
(Python 3):
python3 -m venv myenv
source myenv/bin/activate
Prompt will change to your environment name e.g. myenv.
- Using
virtualenv
:
virtualenv myenv source myenv/bin/activate
Step 1.3 – Install Jupyter Notebook (Recommended way)
- For Linux and macOS:
pip3 install jupyter
Pro Tip: – in case of macOS, after installation of Jupyter using pip, You may get following errors or Warnings for Python PATH. Follow solution-2 to fix Envrionment variables.
"WARNING: The scripts jupyter, jupyter-migrate and jupyter-troubleshoot are installed in '/Users/dev/Library/Python/3.9/bin' which is not on PATH.
WARNING: The script jsonschema is installed in '/Users/dev/Library/Python/3.9/bin' which is not on PATH.
WARNING: The script jupyter-trust is installed in '/Users/dev/Library/Python/3.9/bin' which is not on PATH.
WARNING: The scripts jupyter-kernel, jupyter-kernelspec and jupyter-run are installed in '/Users/dev/Library/Python/3.9/bin' which is not on PATH."
- Using Homebrew package manager in macOS (optional)
brew install jupyter
Step 1.4 – Launch Jupyter notebook in your virtual environment
jupyter-notebook
Install Jupyter notebook on Windows 10 or 11 using pip
- Open a Command Prompt: Press
Win + R
, type “cmd,” and press Enter to open a Command Prompt. - (Optional) Create a Virtual Environment (Recommended): While it’s not mandatory, it’s good practice to create a virtual environment to isolate your Python packages. To create a virtual environment, use the following commands
python --version
python -m venv myenv
myenv\Scripts\activate
- Replace
myenv
with your preferred virtual environment name. - Install Jupyter Notebook with pip:Run the following command to install Jupyter Notebook using
pip
pip --version
pip install jupyter
- This will download and install Jupyter Notebook and its dependencies in your virtual environment or globally based on your choice.
- Launch Jupyter notebook
jupyter-notebook
I hope your Jupyter command related issues has been fixed now. In case you are still facing the issue, then keep following the solution 2.
Solution 2 – Check the environment variables setup
Step 2.1 – Verify Jupyter installation on your system
pip show jupyter
This command should display information about the Jupyter package, including its location as shown in the above image.
Step 2.2 – Check PATH Variable
Ensure that the directory containing Jupyter Notebook’s executable is in your system’s PATH environment variable.
- For Linux based operating systems:
- Open a terminal.
- Check your PATH variable by running:
echo $PATH
- Look for the directory containing Jupyter’s executable (like
/home/<YourUsername>/.local/bin
for user-installed packages). If it’s not in your PATH, you’ll need to add it. For example “/home/dev/Desktop/myenv/bin” is already part of my PATH as shown in the image.
- To add it temporarily for the current session, you can run:
export PATH="$PATH:/home/<YourUsername>/.local/bin"
Replace<YourUsername>
with your actual Linux username.
For example:
$ export PATH="$/home/dev/Desktop/myenv/bin"
- To add it permanently, you should modify your shell’s profile configuration file using your favourite editor (e.g.,
~/.bashrc
for Bash or~/.zshrc
for Zsh). Add the export command to the end of the profile file - After making changes, reload your shell configuration by running:
source ~/.bashrc # or source ~/.zshrc if using Zsh
.
- For macOS:
- Open a terminal.
- Check your PATH variable by running:
echo $PATH
- Look for the directory containing Jupyter’s executable (usually something like
/Users/<YourUsername>/Library/Python/<PythonVersion>/bin
for user-installed packages). If it’s not in your PATH, you’ll need to add it. For example, /user/dev/Library/Python/3.9/bin is not part of $PATH in below mentioned image.
- To add it temporarily for the current session, you can run:
export PATH="$PATH:/Users/<YourUsername>/Library/Python/<PythonVersion>/bin"
Replace<YourUsername>
with your actual macOS username and<PythonVersion>
with your Python version (e.g., Python3.9). - For example, I have added my Jupyter’s bin location
/user/dev/Library/Python/3.9/bin
as shown in the image.
- To add it permanently, you should modify your shell’s profile configuration file (e.g.,
~/.bash_profile
or~/.zshrc
if you’re using Zsh). Add theexport
command as shown in last step to the end of the profile file. - After making changes, reload your shell configuration by running:
source ~/.bash_profile # or source ~/.zshrc if using Zsh
.
- For Windows OS
- Check jupyter directory location as shown in the image.
pip show jupyter
- Open the Windows Start menu and search for “
Environment Variables
.” - Select “
Edit the system environment variables
.” - In the System Properties window, click the “
Environment Variables
” button. - Under “
User variables
,” scroll down and find the “Path
” variable, then click “Edit
.” - In the “
Edit Environment Variable
” window, make sure the directory containing the Jupyter executable is listed. If it’s not there, you’ll need to add it. The default location for user-installed Python packages (including Jupyter) is something likeC:\Users <YourUsername>\AppData\Local\Programs\Python\PythonXX\Scripts
. - Replace
<YourUsername>
with your actual Windows username, andPythonXX
with your Python version (e.g.,Python311
in our case) as shown in the following image. - After adding the directory, click “
OK
” to close all the windows.
- Restart Your Terminal or command prompt: After making changes to the PATH variable, it’s important to close and reopen your command prompt to ensure that the changes take effect.
- Verify Jupyter Command: Finally, try running the
jupyter-notebook
command again. It should now work without the “command not found” error.
These steps should help you resolve the issue and run Jupyter Notebook successfully on Linux, macOS and Windows.
Additional tips and resources to manage Jupyter notebooks –
I recommend to follow these tips while working with Jupyter notebook program –
- Create isolated virtual environment
- Clean up unused environments
- Create requirement files for each project to list specific package versions
- Consider kernel management while using jupyter notebook. Each notebook can be associated with different kernel
- Keep Jupyter and related packages up to date
Check out this interesting Google article that can improve life of any developer using Jupyter.
Conclusion
I am hopeful this tutorial would has helped you to solve your Jupyter command not found related issues. I encourage you to use this powerful tool for your career growth in data analysis and explore its features to your best.