Cannot open Jupyter Notebook in the new zsh shell in macOS

20,972

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.

  1. Open bash profile using the command:

    open ~/.bash_profile
    
  2. There’s a block of code the anaconda installer added to the end of the file. Copy that. It looks something like this

    enter image description here

  3. Open the .zshrc file:

    open ~/.zshrc
    

    And paste the copied code to the end of the file and save it.

  4. Restart the terminal:

    source ~/.zshrc
    
Share:
20,972

Related videos on Youtube

Simran Williams
Author by

Simran Williams

Updated on September 18, 2022

Comments

  • Simran Williams
    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 did pip install jupyter on the home /Users/username and I am using python3.

    • slhck
      slhck over 4 years
      How 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
      Simran Williams over 4 years
      It 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
      slhck over 4 years
      I 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
      slhck over 4 years
      Also, please edit your question and provide the following info: Can you check if /usr/local/bin/jupyter exists? What does echo $PATH show?
    • Simran Williams
      Simran Williams over 4 years
      I 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/App‌​le/bin:/Library/TeX/‌​texbin:/usr/local/sh‌​are/dotnet:/opt/X11/‌​bin:~/.dotnet/tools:‌​/Library/Frameworks/‌​Mono.framework/Versi‌​ons/Current/Commands‌​:/Applications/Xamar‌​in Workbooks.app/Contents/SharedSupport/path-bin
    • slhck
      slhck over 4 years
      It 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
      Simran Williams over 4 years
      It says the requirement already satisfied. I am running python3.
    • slhck
      slhck over 4 years
      And where did you get python3? Via Homebrew? Does pip3 install jupyter work? If you have an additional Python 3 version installed, you might need pip3 to install packages with it.
  • LamaMo
    LamaMo about 4 years
    It gives me The file /Users/sarawasl/.zshrc does not exist. at step 3
  • Dennis Jaheruddin
    Dennis Jaheruddin almost 4 years
    This did not work, also the output was "usage: dirname path" suggesting it is doing the wrong kind of thing
  • curusarn
    curusarn almost 4 years
    Can you run which jupyter and post the output?
  • Nicholas Gooding Rios
    Nicholas Gooding Rios over 3 years
    Excellent 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 run brew cleanup after, but this is the way
  • pr94
    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
    Admin almost 2 years
    Your 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.