5

I recently updated to OSX Catalina. First thing I noticed is that the anaconda3 folder was in the 'Relocated Items' folder so I moved it to /Users/ethanfuerst/. Now, neither conda nor pip will run in my terminal. When I try to run python files, it says none of my modules are imported.

I did the fix recommended here but this fix gives me this error:

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

What do I need to do to get my modules to run and pip and conda to work in my Terminal?

Ethan
  • 534
  • 5
  • 21

4 Answers4

5

I was able to develop a workaround for this issue by installing miniconda from Homebrew (https://brew.sh/). After installing Homebrew, type the following into Terminal:

brew cask install miniconda

Once miniconda is installed, conda commands should be accessible through Terminal and you may also want to run conda update conda to ensure the packages in your environment are consistent.


pip Commands

To get pip to be recognized, run conda install pip after following the above steps.


Finally, you will have to reinstall tools such as Jupyter Notebook and may have to change your approach to opening them. Such tools can be accessed via Terminal with the prefix conda run ...

For example:

conda run jupyter notebook

will open Jupyter Notebook, but the command

jupyter notebook

might not work.


Reinstalling Jupyter Notebook

conda install -c conda-forge jupyter_contrib_nbextensions will install Jupyter Notebook, its dependencies, and its extensions.


Chase
  • 156
  • 1
  • 4
  • 1
    I was able to download conda doing this, and then ran `conda install pip` but still can't run anything from pip. For some reason `conda run jupyter notebook` doesn't work and when I run python files it still says my packages aren't installed. Do you know what could cause these issues? – Ethan Oct 11 '19 at 16:26
  • Hi @Ethan, thanks for your feedback. The reason `conda run jupyter notebook` isn't working is because Jupyter Notebook didn't install with miniconda. Try running `conda install -c conda-forge jupyter_contrib_nbextensions`, which will install Jupyter Notebook as well as its dependencies and extensions. You may also want to run `conda update conda` once everything is installed and working properly. – Chase Oct 12 '19 at 17:10
  • with your command, I was able to install jupytre notebooks and now those will run. Once I run a jupyter notebook, it says that I haven't installed pandas, and pip won't run in terminal. Do you know how to fix this? – Ethan Oct 13 '19 at 20:51
  • Hi @Ethan, since the conda forge command worked, conda is being recognized as valid syntax. Try running `conda install pip` one more time. If this runs, you should be able to install pandas and other packages using pip. If not, try the methods on [this Homebrew page](https://docs.brew.sh/Homebrew-and-Python#python-3x-or-python-2x) for ways to install pip from Homebrew. Let me know if either of these methods solves your problem. – Chase Oct 14 '19 at 05:14
  • Running `conda install pip` told me that pip was alread installed, so I ran both `python3 -m pip install --upgrade setuptools` and `python3 -m pip install --upgrade pip` but once I had run them, pip was still not installed – Ethan Oct 14 '19 at 13:26
  • Hi Ethan, in that case, when you open a new Terminal window, start with: 'conda activate ______' ... filling in the blank space with one of your conda environments. If you haven’t set up any environments yet, fill the blank space with 'base' (if base is not found conda will display some information on how to set up a new conda environment). From here, your pip installs should work. – Chase Oct 15 '19 at 14:13
1

Are you sure you have moved the directory /Users/Shared/Relocated\ Items/Security/anaconda3 to you home directory? If not, move it first.

Alternatively, use the following command instead

export PATH="/Users/Shared/Relocated\ Items/Security/anaconda3/bin:$PATH"

In addition, you can always download and install Anaconda again on macOS Catalina. It worked out-of-the-box on my computer.

nalzok
  • 14,965
  • 21
  • 72
  • 139
  • That command didn't work for me. I had redownloaded anaconda, but the install said that it wasn't compatible with my osx – Ethan Oct 10 '19 at 14:41
  • Just tried redownloading anaconda3. It downloaded in my Home directory, but still can't run conda or pip in Terminal – Ethan Oct 10 '19 at 15:11
1

I had the same problem after the update 10.15.2. What I did was: I changed back the terminal shell to 'bash' (from -zsh). The command I used is: chsh -s /bin/bash

You will then be prompted to enter your password. After closing and reopening a window you will see that the original bash is set.

Alternatively, you can open the terminal preferences and under: "General" "Shells open with:" you can select "command complete path" and enter /bin/bash.

If you wish to reverse the command and linked to -zsh back you simply run the command above using -zsh this time chsh -s /bin/zsh.

Readings: Official from Apple Support: https://support.apple.com/en-us/HT208050 Geek: https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/

Freddy
  • 73
  • 8
-1

Just copy all your codes in a new folder, close and open again anaconda.

That works for me

Jonathan Pacheco
  • 531
  • 1
  • 6
  • 16