cannot import package after conda install in windows



I have been using PyCharm on mac for a while. And only occasionnally on Windows. I'm using Pycharm with Anaconda, python 3.5.2.

Today after updating PyCharm to:
PyCharm Community Edition 2016.3.2
Build #PC-163.10154.50, built on December 28, 2016
JRE: 1.8.0_112-release-408-b6 x86
JVM: OpenJDK Server VM by JetBrains s.r.o

I cannot import any module that I previously import with conda from the Pycharm's terminal. 

For example, I tried:

In PyCharm's terminal: 
conda install matplotlib

Then in PyCharm Console:
import matplotlib

I get the error:

Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2016.3.1\helpers\pydev\_pydev_bundle\", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named 'matplotlib'

Then googling around I read we can import packages from the project interpreter. This allows me to workaround this issue with some packages, I cannot do so with all packages, for example after installing opencv3 (version 3.1 from conda forge), it is neither known by the Pycharm Python console, nor it is to be found in the list of packages of the project interpreter. 

This is not behaving like this on mac, where installing with conda is enough for pycharm for doing my imports. 

Any idea?


1 comment

Apparently, what caused this is that, upon the PyCharm update, PyCharm selected a "Default" anaconda3 interpreter, which one has to select again in the project interpreter. See attached. Yet on this default sync, whatever I install with Conda is not reflected in the list of installed package associated to that "Default" interpreter. But when I select the other interpreter; they are all there. I don't understand this. But for now, things will work. I guess at each update I should be careful... 


Please sign in to leave a comment.