Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandas and Jupyter not found after upgrading to Catalina

I just updated my macOS to Catalina and I can't run python or open a jupyter notebook from terminal anymore. As an example, I get error message "ImportError: No module named pandas" when running my python code, and I get

zsh: command not found: jupyter

when running

jupyter notebook

This issue has brought me to anaconda (I would love someone to explain me why. Does python need anaconda to be ran?). I have tried several suggestions from https://github.com/ContinuumIO/anaconda-issues/issues/10998, e.g. I have tried copying folder "anaconda3" from "Relocated items" folder to "Users//", then

export PATH=''/Users/<username>/anaconda3/bin:$PATH"

but I get either

dquote>

or

zsh: /Users//Applications/anaconda3/bin/conda: bad interpreter: /anaconda3/bin/python: no such file or directory

I then tried to reinstall Anaconda using the graphic installer (from https://www.anaconda.com/distribution/#macos) following advice from someone from the anaconda team (https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/) (I changed installation location to a folder I created in /Users//) but I still get the same error messages when running python3 or jupyter notebook.

How can successfully run python and jupyter notebook with macOS Catalina?

like image 304
Elsa Avatar asked Oct 16 '19 19:10

Elsa


People also ask

Why is jupyter command not found?

"Command jupyter not found":You may need to add the directory where you installed jupyter or pip to your PATH variable... For example, if you successfully installed jupyter but it's complaining that the command is not found, try adding ~/Library/Python/2. XXX/bin and ~/bin to your path.

How do you fix jupyter is not recognized as an internal or external command operable program or batch file?

Restart your command prompt and all your python scripts should run directly on the command prompt anywhere. PS : Also, make sure that your jupyter scripts are there in the Python Scripts folder. A proper installation of Jupyter via pip should have ensured this.

How do I enable Jupyter Notebook on Mac?

3.1. To launch Jupyter Notebook App: Click on spotlight, type terminal to open a terminal window. Enter the startup folder by typing cd /some_folder_name . Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.


3 Answers

After installed macOS Catalina, we can switch the terminal from bash to zsh. There are many advantages from using zsh instead of bash, but One of the issues with zsh is some of the frameworks (jupyter notebook,conda) are not supported directly. Once I typed jupyter notebook in terminal to run it. It displayed “zsh: no such file or directory”.

The solver is simple but very difficult to find online. If jupyter was already installed before the update and stopped working after zsh, you should be able to fix it by: 1.open zshrc in terminal by typing: open .zshrc or $open .zschrc 2. add the following line at the end of the file: source ~/.bash_profile It will ask zsh to use all the information from bash like the path of jupyter.

Hope it can help you out!

like image 146
PercyZ Avatar answered Oct 05 '22 23:10

PercyZ


I'm answering to my own question in case it can help others ;)

I found my answer here: https://medium.com/@singhaniatanay18/mac-os-catalina-update-zsh-instead-of-bash-d688f68f70b8

(see comments as well)

like image 31
Elsa Avatar answered Oct 06 '22 00:10

Elsa


Mac OS BigSur:

  1. Uninstall Anaconda:rm -f Anaconda-Navigator.app
  2. re-install pip3 install jupyterlab
like image 30
Colorado Coder Avatar answered Oct 06 '22 00:10

Colorado Coder