Skip to content Skip to sidebar Skip to footer

How To Get Conda And Virtualenv To Work On Mac Os Catalina?

I previously had Conda running smoothly on Mojave, but I've found that the upgrade to Catalina moves the 'anaconda3' folder to your Desktop > Relocated Items > Security >

Solution 1:

I have the exact same problem and this works for me:

After you move anaconda from "Relocated Items" to ~/anaconda3, edit the first line of ~/anaconda3/bin/conda file from #!/anaconda3/bin/python to #!/Users/USERNAME/anaconda3/bin/python to reflect the change.

Solution 2:

I would probably abstain from using the above solution. That ~/anaconda3/bin directory has lots of runnables (not just the conda one) that would need to be altered in this manual way. For example, unless you make the same change you cannot run jupyter notebook either, neither from base nor from other envs you might have.

My tip: Try getting a requirements file for your virtual envs, and do a fresh installation. You could use pipreqs to get the requirements used for individual projects: https://www.idiotinside.com/2015/05/10/python-auto-generate-requirements-txt/

Solution 3:

No solution will be completely working without fixing the baked-in hard-coded prefix entries in files. There's a longer description and a recommended fix at https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/

Solution 4:

Technically this is reinstalling anaconda, however, I restored all my conda envs so, hopefully this is an acceptable solution!

Here is how I got it working on Catalina as of a few minutes ago (now using z-shell): - Verified the existence of "Relocated Items" directory on my desktop and the "anaconda3" directory and its contents inside - Navigated into the envs directory under "anaconda3" and left the finder window open (see screenshot)

enter image description here

THEN:

  • opened new Terminal (z-shell)
  • ran (this installed to /usr/local/anaconda3):

    brew cask install anaconda

  • after installation was successful I opened my ~/.zshrc file (for my z-shell aliases) and added the following line:

    export PATH="/usr/local/anaconda3/bin:$PATH"

  • saved my ~/.zshrc file, then reloaded with:

    source ~/.zshrc

  • to verify conda command works now, I ran:

    conda env list

  • for me, this showed a base env and that was it

  • then open Finder to the new envs location: open /usr/local/anaconda3/envs/.

  • I dragged (moved) all my old envs into the new envs folder, and then ran:

    conda env list

And all my old envs are back! :)

  • updated my PyCharm interpreter / env paths to reflect the new locations of these envs (had to restart PyCharm after, but now it works!)
  • DONE

Solution 5:

Unsure whether this is considered a comment or at least a temporary answer, but I would refrain from attempting to fix any Catalina compatibility issues with Anaconda for now. See this GitHub issue.

Post a Comment for "How To Get Conda And Virtualenv To Work On Mac Os Catalina?"