34

I had Anaconda on Windows 10 installed in C:\ProgramData\Anaconda3 before using PyCharm. Now PyCharm displays: "Anaconda installation is not found" when I try using a conda env.

I also added Anaconda to PATH.

Is there a way to show PyCharm where Anaconda is installed?

AstronAUT
  • 639
  • 2
  • 7
  • 11

7 Answers7

67

There is an open bug, currently PyCharm and IDEA both seem to detect Conda installation only from %HOMEPATH%/anaconda. https://youtrack.jetbrains.com/issue/PY-26923

The easiest workaround is to create a symlink to $HOME/.anaconda

mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda C:\ProgramData\Anaconda3

Note that C:\ProgramData\Anaconda3 should be replaced with the path to your Anconda installation. If you selected to installed it for "Just Me" instead of "All Users", your default location will be

C:\Users\<your_username>\AppData\Local\Continuum\anaconda3

UPDATE: This issue is now fixed in IDEA and PyCharm since version 2018.1. You can specify a custom path under Python Interpreter or SDK settings in Conda Environment section.

Ahti Kitsik
  • 794
  • 6
  • 5
  • 2
    You saved me a lot of pain. This should be the accepted answer. I installed `anaconda3` through `choco` and it got installed under `C:\tools\Anaconda3`. I was about to uninstall the `choco` package and get the installer directly from the Anaconda site hoping may be that will resolve the issue until I stumbled upon this answer. – Sourav Paul Dec 09 '17 at 04:33
  • 3
    Note: to see where your anaconda is installed, open an anaconda command prompt. The path shown before the prompt is what to include in the symlink second argument in this answer. For me it was C:\Users\\Local\Continuum\anaconda3: https://stackoverflow.com/questions/37117571/where-does-anaconda-python-install-on-windows – Adam Hughes Jan 02 '18 at 18:25
  • 2
    Tip: Must run this from a command prompt that starts with `C:\>` (i.e. it's not on another drive, e.g. drive D:`). If you are on another drive (e.g. drive D:), then go to drive C by typing `C:` at the DOS prompt, or run this command instead: `mklink %HOMEDRIVE%%HOMEPATH%\anaconda c:\ProgramData\Anaconda3` – Contango Jan 14 '18 at 15:33
  • 1
    @AdamHughes not sure why but the path in anaconda command prompt doesn't tell me where it's installed (i use Win10). My path is simply `C:\Users\`. To find my anaconda, i used `conda info --envs` in this command prompt. It lists all of your environments. The active one is highlighted with an asterisk mark – F.S. Jan 18 '18 at 06:31
  • With this symbolic link trick, Pycharm can indeed find the Anaconda installation, but when you create a virtual environment with Pycharm, the name of that virtual environment occurs twice in the result of `conda info --envs`, while an environment made with Anaconda navigator only appears once. The 2 paths for an environment created by Pycharm are exactly the 2 paths that are part of the symbolic link. Will these 2 occurrences instead of 1 cause problems? – Sander Vanden Hautte Feb 14 '18 at 12:49
  • 1
    Using %HOMEPATH% might fail when it is located on a network drive. I used %USERPROFILE% instead and then defined a local interpreter in PyCharm. – Juergen Mar 12 '18 at 15:56
  • Im getting this error: C:\ProgramData\Anaconda3\python.exe: can't open file 'create': [Errno 2] No such file or directory – Pedro77 Feb 13 '19 at 13:36
  • @Pedro77 apparently C:\ProgramData\Anaconda3 is not the directory where your Conda is installed. Doublecheck the installation and adjust the path accordingly. Also not that PyCharm allows custom paths (since version 2018.1). – Ahti Kitsik Feb 14 '19 at 14:23
  • @AhtiKitsik Actually it is. Anaconda shortcut path: "C:\ProgramData\Anaconda3\pythonw.exe". I just did a fresh Anaconda and PyCharm install, for all users, and I can't make PyCharm work with it. "What a charm". – Pedro77 Feb 14 '19 at 16:01
  • 1
    To clarify that UPDATE: In PyCharm's Settings => Project Interpreter, click top-right cogwheel "Add..." to get to the "Add Python Interpreter" window. There you may choose between a Virtualenv Environment, Conda Environment etc.; suppose we choose Conda Environment. Then choose "Existing environment", and note the little ellipsis button ("...") to the right of the "Interpreter" select box. THERE you may browse your local directory structure. Go ahead and find your python executable at the root of your existing Conda environment, wherever you created it. Done. – Yaniv Feb 24 '19 at 10:35
  • 1
    @Yaniv I did exactly just this for about an hour now. When I type `where conda` I get `C:\Users\11241365\AppData\Local\Continuum\anaconda3\condabin\conda.bat` but when I try to browse for my python executable, I can only find `Application Data` folder and no `AppData` folder and when I press that, nothing shows up. UPDATE: Okay apparently, `AppData` is a hidden folder and typing it manually showed it for me. – Pherdindy Nov 26 '19 at 00:25
4

In @Ahti Kitsik's answer above, the following line did not work, and resulted in a an error: mklink /D %HOMEPATH%\anaconda C:\ProgramData\Anaconda3

Because of a different install location, the following worked for me:

mklink /D "%HOMEPATH%\anaconda" "C:\Dev\Anaconda3"

"C:\Dev\Anaconda3" should be the anaconda installation folder on your PC.

Also, be sure to run the cmd with administrator privilege, otherwise you will get a permission error when trying to create the symlink.

Albert Rothman
  • 998
  • 2
  • 9
  • 27
Chenhua
  • 185
  • 2
  • 10
  • C:\Users\pedro\anaconda\python.exe: can't open file 'create': [Errno 2] No such file or directory – Pedro77 Feb 13 '19 at 13:39
4

You can't find anaconda python in your console at first.Click Configure Interpreters in blue.

enter image description here

Click the little gear under reset in blue(right + up corner), and chose 'add local'. enter image description here point to your python in anaconda

enter image description here

Here you are

enter image description here

Tina Liu
  • 195
  • 12
  • Brilliant, this worked for me. I couldn't use any of the symlink solutions because the organisation I work for has blocked access to the command prompt, so I needed a full GUI solution. – EddyTheB Aug 23 '18 at 11:22
1

I fixed this by:

  • Uninstalling the Anaconda that was installed with Visual Studio 2017. I did this by unticking the option within the VS2017 installer.
  • Installing Anaconda after downloading the official installer.
  • Rebooting my PC.

My theory is that VS2017 installs Anaconda in a non-default location, and PyCharm cannot find it. The Anaconda installer states that VS2017 should still work fine with Python, even after this change.

Contango
  • 76,540
  • 58
  • 260
  • 305
1

I faced the same issue on Ubuntu 16.04 where I had Anaconda installed under ~/.local/opt/anaconda3. Creating a symlink under ~/anaconda3 solved the issue for me.

tzelleke
  • 15,023
  • 5
  • 33
  • 49
0

mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda "C:\Program Files\Anaconda3"

LeoZ
  • 635
  • 6
  • 5
0

I had a similar problem running linux (Ubuntu) because I installed anaconda to a custom location. Creating a symbolic link to anaconda in home directory solved the problem.

You can run the following command to do that:

ln -s /_my_custom_path_to_/anaconda3/ /home/_my_user_name_/anaconda3

* keep in mind _my_custom_path_to_ and _my_user_name_/ are your custom path to anaconda and user name correspondingly

molexi
  • 530
  • 5
  • 13