Pycharm doesn't activate Anaconda virtual environment - on Windows 7

Answered

 

I'm using Pycharm Pro 2017.3 EAP (PY-173.34153.3) on Windows 7 Pro, 64-Bit.

The root Anaconda environment is Python 2.7, but I have several Python 3.6 environments created.

For my PyCharm project, I've selected the 3.6 interpreter, and PyCharm shows this its terminal window.

(C:\ProgramData\Anaconda2\envs\py36dev) C:\Users\MyUserName\Documents\Sources\GIT\Python\MyProject>

 

Python 3.6 is invoked when I run my application in the terminal as well as through the debugger. This is what is expected.

However, the Anaconda virtual environment for Python 3.6 is not really activated.

conda list shows the packages for the root Anaconda environment, which is Python 2.7

(C:\ProgramData\Anaconda2\envs\py36dev) C:\Users\MyUserName\Documents\Sources\GIT\Python\MyProject>conda list
# packages in environment at C:\ProgramData\Anaconda2:
#
_license 1.1 py27_1
alabaster 0.7.10 py27_0
anaconda custom py27_0
anaconda-client 1.6.3 py27_0
anaconda-navigator 1.6.2 py27_0
anaconda-project 0.6.0 py27_0
asn1crypto 0.22.0 py27_0
astroid 1.4.9 py27_0

 

When I fully activate the 3.6 environment in the Pycharm terminal:

activate py36dev

the prompt changes as expected, indicating that the desired Anaconda environment is fully activated.

(py36dev) (C:\ProgramData\Anaconda2\envs\py36dev) C:\Users\MyUserName\Documents\Sources\GIT\Python\MyProject>

 

conda list now shows the packages for the active environment, as expected.

conda list
# packages in environment at C:\ProgramData\Anaconda2\envs\py36dev:
#
_license 1.1 py36_1
alabaster 0.7.10 py36_0
anaconda 4.4.0 np112py36_0
anaconda-client 1.6.3 py36_0

 

It looks like PyCharm isn't really activating the Anaconda environment, even though it is using the correct interpreter that I've selected.

It seems as though this could cause a world of problems.

 

 

 

 

 

8 comments
Comment actions Permalink

I am using windows 10, pycharm 2017.3.3, maybe this can help to others who facing same problem:

  1. create new project
  2. below location input box, in project interpreter(which is Python2.7):
  3. click existing interpreter, click the grid, add local
  4. click virtualenv environment, then click button after the interpreter, placed <drive>:\<anaconda installation folder>\envs\<your environment>\python.exe
  5. done

 

hope it helps

0
Comment actions Permalink

Hi! I believe it's a known problem: PY-23417.

0
Comment actions Permalink

Same happens for me, the conda environment doesn't get activated. This happens on 2018.3 and 2019.1 on Windows 10. On 2018.3 I can at least start PyCharm from within a conda environment and it picks up all the correct settings, however this doesn't work on PyCharm 2019.1. Any ideas when this will be fixed?

1
Comment actions Permalink

Please report it to https://youtrack.jetbrains.com/issues/PY and attach idea.log from Help | Show Log in...

0
Comment actions Permalink

Not addressed this in 2019.1 Mac. Reallly annoying. 

0
Comment actions Permalink

I am also getting this problem, any solution found?

0
Comment actions Permalink

Hi all,

If it still doesn't work in 2019.1.1, you probably face this issue https://youtrack.jetbrains.com/issue/PY-35141

 

0
Comment actions Permalink

Hi all,

I met exactly the same issue even with a correct setting in python interpreter(a python interpreter inside conda envs has been set to project.). The problem is that Pycharm 2018.2 may have an issue picking up the environment settings in conda. I upgraded to Pycharm 2020.1, the issue well resolved.

 

0

Please sign in to leave a comment.