I recently upgraded to macOS Catalina and it prompted me to upgrade to the zsh shell. But now when I try to run jupyter notebook, it says command not found. I tried looking for it in .bashrc but .bashrc does not exist. What do I do? I did pip install jupyter on the home /Users/username and I am using python3.
6 Answers
There is some additional configuration that you need to do to get it to work.
Open bash profile using the command:
open ~/.bash_profileThere’s a block of code the anaconda installer added to the end of the file. Copy that. It looks something like this
Open the
.zshrcfile:open ~/.zshrcAnd paste the copied code to the end of the file and save it.
Restart the terminal:
source ~/.zshrc
I have encountered the similar annoying problem and here is my one-line solution:
Open terminal and type:
brew install jupyterIf you haven't install
brewon your Mac, please follow the instruction here:/bin/bash -c "$(curl -fsSL )"Wait for around 10 minutes until the installation finishes and try
jupyteragain.
Explain:
It helps download a lot of "Catalina" related packages, like
==> Downloading
......
==> Downloading
......See for the latest discussions on this issue.
1If it was working before you just need to change the default shell to Bash. You can do that by running the following code in the terminal.
chsh -s /bin/bash
Running python or jupyter-notebook via pyenv, then this answer is for you.
(i.e. python/jupyter-notebook is installed inside /Users/<hostname>/.pyenv directory. See this to install pyenv)
After installing the oh-my-zsh shell:
Open the .zshrc file in a text-editor ->
open ~/.zshrcAppend pyenv in its list like ->
plugins=(git node rails pyenv)ohmyzsh provides various plugins w.r.t different languages & framewroks. Search for the plugins section in the .zshrc file and append pyenv there.
Launch a new instance of your zsh-terminal. Now, your zsh terminal instance will be able to detect pyenv and the packages installed inside it.
Now, check for the jupyter ->
which jupyter. You'll see the path where jupyter is installed on machine.Or, simply launch jupyter on terminal->
jupyter notebook.Notebook will open up in your favorite browser!
sudo -H pip3 install jupyter-H (HOME) sets the HOME environment variable to the home directory of the target user (root by default).
Zsh does not use ~/.bashrc and ~/.bash_profile it uses ~/.zshrc instead.
Executing this command in bash will add a line to your ~/.zshrc that should fix your issue:
echo 'PATH=${PATH}:'"$(dirname "$(which jupyter)")" >> ~/.zshrcBreakdown of what the command does:
- Lookup path of
jupyter(which jupyter) - Take directory from the path from step 1 (
dirname path_from_step_1) - Construct a line that adds this directory to your
$PATHenv variable (PATH=${PATH}:directory_path_from_step_2) - Append the line to end of your
~/.zshrc(echo the_line_from_step_3 >> ~/.zshrc)
Basically, the command above asks bash where is jupyter and then tells zsh to also search there when looking for programs and executables. That means that if jupyter works in your bash it should work in your zsh after this.
I don't have a Mac to test this on so if this doesn't work please leave a comment so I can debug this and figure out a solution.
2