Search code examples
pythonpycharmanaconda

Module not found error in PyCharm, but it is installed as an Anaconda package


I have installed Anaconda 3 and PyCharm Community Edition after that. I am able to chose the interpreter to be a Conda environment. But when I try using certain packages, such as Matplotlib, it throws "Module not found error". When I run pip, it returns saying that matplotlib is available.

pip install matplotlib
Requirement already satisfied: matplotlib in./anaconda3/lib/python3.6/site-packages

Clearly the package is there and for some reason it does not show up.


Solution

  • Apparently the naming of the selection depends on the operating system, but the Python interpreter can be selected as follows:

    • Menu FilePreferencesProjectPython Interpreter (macOS)
    • Menu FileSettingsProjectPython Interpreter (Windows and Linux)

    Using the dropdown, select the right Python interpreter. Depending on your OS and setup, this can be the default interpreter (e.g., ~/anaconda3/bin/python) or the interpreter corresponding to the Conda environment of your choice (e.g., C:\users\username\.conda\envs\projectname\python.exe).

    Screenshot of PyCharm Settings

    Now all the packages installed with Anaconda should be listed.

    Screenshot of PyCharm Preferences listing packages installed