Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find pip, conda, python modules after OSX Catalina update

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?

like image 968
Ethan Avatar asked Oct 10 '19 04:10

Ethan


People also ask

Why is conda not pip?

Conda vs pip Although, both conda and pip are package managers, they are very different: Pip is specific for Python packages and conda is language-agnostic, which means we can use conda to manage packages from any language Pip compiles from source and conda installs binaries, removing the burden of compilation.

Is pip installed with conda?

Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately. Conda environments replace virtualenv, so there is no need to activate a virtualenv before using pip. It is possible to have pip installed outside a conda environment or inside a conda environment.

Does conda update pip packages?

No, conda update and conda install don't update packages installed with pip (or install them using pip ). These conda commands only check your "default" anaconda-channels or the ones specified with -c , they ignore everything else.


3 Answers

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.


like image 199
Chase Avatar answered Oct 20 '22 12:10

Chase


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.

like image 1
nalzok Avatar answered Oct 20 '22 12:10

nalzok


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/

like image 1
Freddy Avatar answered Oct 20 '22 12:10

Freddy