Conda not found after upgrading to macOS Catalina

纵饮孤独 提交于 2019-12-18 12:53:07

问题


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?


回答1:


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




回答2:


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.




回答3:


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.




回答4:


use this (do not use double " )

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



回答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.

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.




回答6:


I reinstalled anaconda via the mac terminal and it works fine.




回答7:


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"




回答8:


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.




回答9:


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



回答10:


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



来源:https://stackoverflow.com/questions/58291108/conda-not-found-after-upgrading-to-macos-catalina

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!