Jupyter Notebook and JupyterLab are essential tools for working with Python and data analysis. When attempting to perform Jupyter-related instructions in your command prompt or terminal, you may get a frustrating error.
'jupyter' is not recognized as an internal or external command,operable program or batch file.
This error can occur if your Jupyter installation is outdated or not complete. The error message is as followed:
This error message might be troubling, so let’s take a closer look at this error and learn how we can fix it.
What is the Error?
The error message “Jupyter is not recognised as an internal or external command” indicates that the Jupyter executable cannot be found by the operating system. This problem frequently arises when attempting to run Jupyter commands from the command prompt or terminal.
The ‘jupyter’ executable is not recognized as a valid command because it’s not in the system’s PATH environment variable.
Causes of the Error
The error “jupyter is not recognized as an internal or external command, operable program or batch file” occurs due to following reasons:
1. Outdated or Missing Installation
An outdated or incomplete Jupyter installation is a common source of this problem. If your Jupyter installation is outdated or incomplete, the system will be unable to locate the files required to perform the command, resulting in the error.
2. PATH Environment Variable Issue
The PATH environment variable is essential for command execution. It includes a list of folders through which the system searches when you run a command. If the directory containing the Jupyter executable is not in the PATH, the system will not know where to look when you run the jupyter command.
Solutions to Fix the Error
We can take the following measures to resolve the error.
1. Solutions to Fix the Error in Windows
Following solutions can be used to resolve the error when occured on windows.
a) Install Jupyter using pip Application
If you already have jupyter but it is not working properly then reinstall jupyter on your command system. For uninstalling previous jupyter, steps are as followed:
- Click on the “Start” button located in the Windows taskbar.
- From the menu that appears, select “Settings.”
- Inside the Settings window, you’ll find a range of options. Locate and select “Apps” from the menu tiles. From there you can uninstall your jupyter notebook.
Now to install jupyter notebook on your system you can use pip application.
Open your Command Prompt:
Go to start menu and search command prompt or directly press Windows+R then write cmd and click enter. Now, run the following code on your command prompt to install jupyter:
python -m pip install jupyter
b) Add Jupyter to the PATH
Step 1: Locate your jupyter installation directory
- Open your command prompt on window.
- If you are not sure about your jupyter installation directory, you can use the
'which'
command to locate it.which jupyter
This code will display complete path to jupyter executable.
Step 2: Add Jupyter to PATH
- Right-click on the Start button and select System.
- In the System wndow, Click on “Advanced System Settings” on left sidebar.
Step 3: Modify Envirounment Variables
- In Advanced System Settings, Click “Envirounment Variables” button at the bottom.
- Under “Envirounment variables,” find and select the “Path” variable, then click the “Edit” button.
Step 4: Adding Jupyter PATH
- In the Edit Environment Variable window, click the “New” button.
- Paste the path to the Jupyter executable that you obtained in Step 1.
- Click “OK” to close all the windows and apply the changes.
Step 5: Verify Jupyter PATH Addition
Now, Run the following command to check verification of your jupyter PATH.
jupyter notebook
If your jupyter notebook runs without any error, the you have successfully added jupyter to your PATH.
2. Solutions to Fix the Error in Linux / macOS
Following solutions can be used to resolve the error when occured on linux or macOS.
Adding Jupyter to the PATH
If you get the “Jupyter’ is not recognised” problem on Linux or macOS, you can fix it by doing the following:
Step 1: Locate your jupyter installation directory
- Open your command prompt.
- If you are not sure about your jupyter installation directory, you can use the
'which'
command to locate it.which jupyter
This code will display complete path to jupyter executable.
Step 2: Change the Shell Configuration File
Open your shell configuration file using a text editor. For ‘bash’ shell, you can use the following command:
nano ~/.bashrc
And if you have ‘zsh’ shell then use the following command:
nano ~/.zshrc
And if you are using different shell then adjust file name accordingly.
Step 3: Add Jupyter to PATH
Add the following line at the end of the file (replace /path/to/jupyter with the actual path you acquired in Step 1):
export PATH=/path/to/jupyter:$PATH
This command will add the Jupyter installation directory to your PATH.
Step 4: Save and Apply Changes
For ‘nano’, press ‘CTRL+0’, then press ‘Enter’ to save and then exit your editor.
Step 5: Refresh Shell Configuration
Give the following command to your terminal to refresh the shell configuration. for ‘bash’ shell:
source ~/.bashrc
Step 6: Verfiy Jupyter PATH AdditionNow, Run the following command to check verification of your jupyter PATH.
jupyter notebook
If your jupyter notebook runs without any error, the you have successfully added jupyter to your PATH.
3. Solutions to Fix the Error using Official Installer
Another way to solve this issue is to add Python to the PATH using an official installer.
Step 1: Download Python Installer
- Visit the Official website of Python to download the installer or you can use the following link:
https://www.python.org/downloads/ - Click on the download link to start downloading the installer.
Step 2: Run the Installer
Locate the downloaded Python installer executable on your computer and run it.
Step 3: Follow Installation Steps
- On the installation screen, you’ll see options for customizing the installation. Check the box that says “Add python.exe to PATH.”
- If the “Customize installation” option is available, choose it. This will allow you to customize the installation components and installation directory. This step is optional, but it gives you more control over the installation.
Step 4: Installation Progress
- Click The Next button to start installation.
- Select the location where you want to install python.
Step 5: Complete the Installation
Once the installation is complete, you’ll see a screen confirming the successful installation. Step 6: Verify Python Installation
After the installation is complete, open a Command Prompt and run the following command:
python --version
You would see the version of Python you just installed.Step 7: Install Jupyter Notebook
Now, run the following code on your command prompt to install jupyter:
pip install jupyter
Step 8: Verify Your Jupyter Notebook Installation
After the installation is complete, you can verify it by running the following command in the Command Prompt:
jupyter notebook
By following these steps, you’ve installed and set up Jupyter Notebook on your Windows system using the Python installer.
Wrapping Up
In conclusion, the “Jupyter’ is not recognized” error can be caused by outdated installations or issues with the PATH environment variable. This error causes a lot of problems so make sure you follow the above solutions. And in order to prevent such problems follow the following preventive measures:
- Keep your Jupyter installation up to date. Regular updates often include bug fixes and improvements that can prevent issues. You can use the following command to update Jupyter via pip:
pip install --upgrade jupyter
- After installing or updating Jupyter, verify that the installation directory has been added to your PATH environment variable. You can do this by checking your system’s environment variables or by running the
echo %PATH%
command (Windows) orecho $PATH
command (Linux/macOS) in the command prompt or terminal.