Cannot open Jupyter Notebook in the new zsh shell in macOS
Solution 1
I have encountered the similar annoying problem and here is my one-line solution:
-
Open terminal and type:
brew install jupyter
-
If you haven't install
brew
on your Mac, please follow the instruction here: https://brew.sh//bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
Wait for around 10 minutes until the installation finishes and try
jupyter
again.
Explain:
It helps download a lot of "Catalina" related packages, like
==> Downloading https://homebrew.bintray.com/bottles/jupyterlab-2.1.5.catalina.bottle.tar.gz
......
==> Downloading https://homebrew.bintray.com/bottles/ipython-7.16.1.catalina.bottle.tar.gz
......
See https://github.com/dotnet/interactive/issues/34 for the latest discussions on this issue.
Solution 2
There is some additional configuration that you need to do to get it to work.
-
Open bash profile using the command:
open ~/.bash_profile
-
There’s a block of code the anaconda installer added to the end of the file. Copy that. It looks something like this
-
Open the
.zshrc
file:open ~/.zshrc
And paste the copied code to the end of the file and save it.
-
Restart the terminal:
source ~/.zshrc
Related videos on Youtube
Simran Williams
Updated on September 18, 2022Comments
-
Simran Williams over 1 year
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 didpip install jupyter
on the home /Users/username and I am using python3.-
slhck over 4 yearsHow did you install Jupyter in the first place? Which Python distribution are you running currently? The built-in one, or Homebrew, or some other package?
.bashrc
is not usually used on macOS, and anyway it isn't what ZSH would read. -
Simran Williams over 4 yearsIt was working fine until before I updated the default shell. I could go to the terminal and type in
jupyter notebook
and it would launch. -
slhck over 4 yearsI know, you mentioned that in your question. My question was how you installed Jupyter (and Python) in the first place? Jupyter is not shipped with macOS.
-
slhck over 4 yearsAlso, please edit your question and provide the following info: Can you check if
/usr/local/bin/jupyter
exists? What doesecho $PATH
show? -
Simran Williams over 4 yearsI did
pip install jupyter
. And, no the/usr/local/bin/jupyter
does not exist.echo $PATH
shows/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
-
slhck over 4 yearsIt would be better if you could edit your question to include this info. What happens when you now run
pip install jupyter
? And, sorry, I have to ask again, what kind of Python distribution are you using? -
Simran Williams over 4 yearsIt says the requirement already satisfied. I am running python3.
-
slhck over 4 yearsAnd where did you get
python3
? Via Homebrew? Doespip3 install jupyter
work? If you have an additional Python 3 version installed, you might needpip3
to install packages with it.
-
-
LamaMo about 4 yearsIt gives me The file /Users/sarawasl/.zshrc does not exist. at step 3
-
Dennis Jaheruddin almost 4 yearsThis did not work, also the output was "usage: dirname path" suggesting it is doing the wrong kind of thing
-
curusarn almost 4 yearsCan you run
which jupyter
and post the output? -
Nicholas Gooding Rios over 3 yearsExcellent response, this did the update to use jupyter on zsh. You will still need to run
brew link
with the overwrite option for ipython and jupyter; and also runbrew cleanup
after, but this is the way -
pr94 almost 3 years@LamaMo hopefully solved it by now, but for others who might have the same issue: the ~/.zshrc doesn’t exist by default in macOS so you need to create it by e.g.
nano ~/.zshrc
-
Admin almost 2 yearsYour answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.