zsh

How to Fix – zsh: command not found: jupyter Error on macOS

Zsh is a robust command-line shell that offers enhanced features and customization options; however, when using Jupyter Notebook with Zsh as the default shell, you may encounter the “zsh: command not found: jupyter” error, preventing you from running commands within Jupyter.

This article will provide an easy guide to resolve this error, ensuring a seamless experience with Jupyter and Zsh.

How to Fix – zsh: command not found: jupyter

Jupyter can be installed on Mac from Zsh via the pip installer using the following command:

pip3 install jupyter

 

However, after the installation, when you run the command in Jupyter with Zsh as the default shell, you may encounter the following error message:

jupyter notebook

 

This error indicates that Jupyter cannot locate the specified command within the Zsh shell environment. It typically occurs due to incorrect or incomplete configuration.

Steps to Fix – zsh command not found: jupyter Error on macOS

Follow these step-by-step instructions to fix the zsh: command not found jupyter error in Jupyter:

Step 1: Open the Configuration File

Open the .zshrc configuration file using the nano editor from the following command:

sudo nano /etc/zshrc

 

Step 2: Add the Jupyter Path

Append the directory path inside the file to inform the Zsh to find the Jupyter at the /bin location.

export PATH="$PATH:/Users/awaiskhan/Library/Python/3.11/bin"

 

Note: Check for the username since it will be different in your case.

Step 3: Save the File

Now, save the file by using the CTRL+X key, add Y and press Enter to go back to the Zsh terminal.

Step 4: Reload Changes

You must reload the changes to the Path variable file using the source command to ensure the changes are correctly done to the file.

source /etc/zshrc

 

Step 5: Restart the Terminal and Run the Command Again

Once the changes are successfully done, you must restart your terminal and run the Jupyter command again.

jupyter notebook

 

This time, you will be able to run the Jupyter-related commands without an error.

Conclusion

zsh: command not found: jupyter error prevents users from running commands with Jupyter. This error can be resolved by updating the Zsh configuration file to include the Jupyter path; after that, you must reload the changes to the file using the source command. Then restart the terminal after the changes and enjoy uninterrupted usage of Jupyter with Zsh.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.