user1315621
user1315621

Reputation: 3412

Conda not found after upgrading to macOS Catalina

I've just updated my MacBook to Catalina. After the update, zsh can't find anymore. In fact, in my .zshrc I had:

export PATH=/anaconda3/bin:$PATH

However, the path /anaconda3/bin doesn't exist anymore. Does that mean that I have lost all of my environment?

Upvotes: 27

Views: 34874

Answers (11)

Muneerah Rashed
Muneerah Rashed

Reputation: 323

This Commands works for me :

$ export PATH='/opt/anaconda2/bin:$PATH'
$ conda init zsh

Upvotes: 0

Steven Barnard
Steven Barnard

Reputation: 604

There is now a fix from anaconda.

Another key change since the last release is that Apple released macOS version 10.15 – Catalina. Unfortunately, this was a breaking release for previous versions of Anaconda that used the pkg installer. The Anaconda Distribution 2019.10 installers address the issues and should install without trouble on macOS Catalina. If you would rather repair your current Anaconda installation, please check out this blog post for tips.

https://www.anaconda.com/anaconda-distribution-2019-10/

  1. Delete old installs first.
  2. Install the new 2019.10+ distro.
  3. Open Terminal/cmd Test out conda -V
  4. Test out jupyter notebook

Everything worked perfectly for me, no need to change paths or anything.

Upvotes: 2

Eden
Eden

Reputation: 76

Copy anaconda3/ path to /Users/<my_user>/

Then export PATH='/Users/<my_user>/anaconda3/bin:$PATH'

Edit file:

  • /Users/<my_user>/anaconda3/conda

Edit the first line like:

FROM #!//anaconda3/bin/python
TO  #!/Users/<my_user>/anaconda3/bin/python

Save changes to /Users/<my_user>/anaconda3/bin/conda init zsh

Should work

Upvotes: 3

Josmy
Josmy

Reputation: 426

None of the existing answers worked for me but this one does.

  1. Download anaconda's self-contained prefix replacement tool at https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe and make it executable:

    curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr
    
  2. Move your anaconda3 folder from Relocated Items to your home folder: ~/anaconda3.

  3. Fix your folder using the following command:

    ./cpr rehome ~/anaconda3
    
  4. Re-run conda init to fix your conda shell command:

    source ~/anaconda3/bin/activate
    
    conda init
    

If you are using zsh,replace the last command with:

conda init zsh

Upvotes: 6

Reza
Reza

Reputation: 1

I installed the anaconda successfully through command mode, still was not running.

So, conda was installed but not activated.

My steps to solution:

  1. restart computer
  2. source ~/anaconda/bin/activate

(in terminal; activation needs to run successfully)

  1. conda init

(needs to run without any error)

  1. conda config --set auto_activate_base True

(this will activate conda automatically to run conda)

  1. if you don't want auto activation, give the argument "False" instead of "True". each time before running conda, you will have to execute "conda init"

This also solved another problem - my spyder was not running from navigator. Now it's running fine.

If it does not work, let me know.

Upvotes: 0

matt525252
matt525252

Reputation: 732

I followed this post and it worked (I did it for python 3). Summary of steps:

  1. Relocate anaconda3 folder from Relocated Items to you home
  2. Download the the command line installer for Anaconda3
  3. Make the install script executable (chmod +x)
  4. Run the installer with the -u option to upgrade an existing Anaconda installation:

    ./<name of anaconda installer> -u

  5. add this line to your .bash_profile:

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

Upvotes: 0

keser
keser

Reputation: 2642

If you are using zsh, conda installer adds a conda init script at the end of your ~/.bash_profile file. You should copy it and paste into your ~/.zshrc file.

Upvotes: 3

Jhixx
Jhixx

Reputation: 21

use this (do not use double " )

export PATH='/Users/myname/anaconda3/bin:$PATH'

Upvotes: 2

user12157457
user12157457

Reputation:

You can find the entire anaconda3 environment in a shortcut link named 'Relocated Items' on your desktop. It appears as though the upgrade to Catalina does not allow the Conda environment to be installed under a user directory now likely having to do with the new system volume move to a read-only partition.

This issue has been opened as far back as June 10th, I am a little disappointed that it was not resolved before the Catalina upgrade came around.

There is a solution that appears to work without losing your environment, see this link: https://github.com/ContinuumIO/anaconda-issues/issues/10998#issuecomment-539215005

From the link:

  1. Copy the folder anaconda3 located in Relocated Items to /Users/myname/

  2. Open Terminal

  3. Enter: export PATH='/Users/myname/anaconda3/bin:$PATH'

  4. Enter: conda init zsh

Upvotes: 40

Kaymal
Kaymal

Reputation: 586

Anaconda has published a blog post on the issue. There seem to be two main options:

  1. Reinstallation: for now shell installer only (you’ll need to wait for the new installer if you rely on the GUI instead).

  2. Repair (experimental): will allow you to fix your old installation and keep all of your old environments

You can check the Anaconda website for further information.

Upvotes: 10

Chase
Chase

Reputation: 156

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.

Finally, you may have to change your approach to opening Anaconda tools such as Jupyter Notebook. 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. A similar question was asked on this post.

Upvotes: 1

Related Questions