jupyter is not recognized as an internal or external command

avatar
Borislav Hadzhiev

Last updated: Apr 4, 2024
5 min

banner

# jupyter is not recognized as an internal or external command

The error "'jupyter' is not recognized as an internal or external command, operable program or batch file" occurs for 2 main reasons:

  1. Not having the jupyter module installed.
  2. Not having the path to Python and pip in your user's PATH environment variable.

jupyter is not recognized as internal or external command

Open your Command Prompt shell and run the following command to install the jupyter module.

cmd
pip install jupyter python -m pip install jupyter py -m pip install jupyter python3 -m pip install jupyter # ๐Ÿ‘‡๏ธ If you get a permissions error pip install jupyter --user

pip install jupyter

You can also install Jupyter Lab.

shell
pip install jupyterlab # or with pip3 pip3 install jupyterlab # or with the `python -m` prefix python -m pip install jupyterlab

Once you have the jupyter module installed, try to run the notebook with the following command.

cmd
jupyter notebook python -m notebook py -m notebook # ๐Ÿ‘‡๏ธ for JupyterLab users python -m jupyterlab py -m jupyterlab jupyter-lab

python m start notebook

The python -m notebook command should work even if you don't have the path to pip in your PATH environment variable.

If the installation command doesn't succeed, try running CMD as an administrator.

To open CMD as an administrator:

  1. Click on the Search bar and type CMD.

  2. Right-click on the Command Prompt application and click "Run as administrator".

run cmd as administrator

If you get the error "'pip' is not recognized as an internal or external command", use the python -m command when installing jupyter.

shell
python -m pip install jupyter py -m pip install jupyter python3 -m pip install jupyter

You can also try to upgrade the package with the --upgrade option.

shell
python -m pip install jupyter --upgrade py -m pip install jupyter --upgrade python3 -m pip install jupyter --upgrade

Try to issue the following command to run the notebook after having upgraded jupyter.

cmd
jupyter notebook python -m notebook py -m notebook

If you see an error message that "ps1 cannot be loaded because running scripts is disabled on this system", run the following command, type "yes" when prompted and rerun the activation command.

PowerShell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
You can verify that the jupyter module is installed by using the pip show jupyter command.
PowerShell
pip show jupyter python -m pip show jupyter py -m pip show jupyter python3 -m pip show jupyter

The pip show jupyter command will either state that the package is not installed or show a bunch of information about the package, including the location where the package is installed.

If the error persists, you have to add Python and pip to your user's PATH environment variable.

# Add Python to your user's PATH environment variable

To add Python to your user's PATH environment variable:

  1. Click on the Search bar and type "environment variables".
  2. Click on "Edit the system environment variables".

edit system environment variables

  1. Click on the "Environment Variables" button.

click environment variables

  1. In the "User variables for YOUR_USER" section, select the "Path" variable and click "Edit".

select user path click edit

  1. Click on "New" and then click "Browse".

click new browse

  1. You can use one of the following commands to check where your Python installation is located.
cmd
python -c "import os, sys; print(os.path.dirname(sys.executable))" where python

find python path

For me, the path is the following.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310

Note that I have Python 3.10 installed, which is reflected in the PATH.

  1. Add the path to Python and then add the path to the Scripts directory that is located in your Python3X folder.

    This is where the executable files are located, including pip.exe and jupyter.exe.

For me, it is the following path.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310\Scripts

add scripts folder

  1. Once the two paths are added, confirm the changes by clicking on the "OK" button twice.

added python and pip to path

  1. Close your Command prompt application and then reopen it.
Note that you must restart your Command prompt shell for the changes to take effect.

You might also have to restart your PC, but that's not always necessary.

Try to run the jupyter notebook command after restarting CMD.

cmd
jupyter notebook python -m notebook py -m notebook # ๐Ÿ‘‡๏ธ for JupyterLab users python -m jupyterlab py -m jupyterlab jupyter-lab

If you still encounter issues, try to add Python to your PATH using the official installer.

  1. Download the installer from the official python.org website.

  2. If you have Python already installed, start the installer and click on "Modify".

click modify

You can leave the optional features ticked.

optional features

  1. On the "Advanced Options" screen, make sure to tick the "Add Python to environment variables" option.

add python to environment variables

  1. Once the "Add Python to environment variables" checkbox is checked, click "Install".
Now your Python installation should be set up correctly and Python should be added to your user's PATH environment variable.

If that didn't work, your Python installation might be corrupted.

Start the installer again and click on "Uninstall".

uninstall python

Now that you don't have Python installed on your machine, start the installer again and make sure to tick the "Add python.exe to PATH" option.

add python exe to path

The checkbox won't be checked by default.

Once the "Add python.exe to PATH" checkbox is checked, click on "Install Now".

After the installation, Python will be installed and configured properly.

# Conclusion

To solve the error "'jupyter' is not recognized as an internal or external command, operable program or batch file", make sure:

  1. You have the jupyter module installed.
  2. You have the path to Python and pip in your user's PATH environment variable.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.

Copyright ยฉ 2024 Borislav Hadzhiev