CurryChurner
CurryChurner

Reputation: 11

Why can't I import Pandas and Matplotlib in Pycharm from Anaconda, when it works with Spyder?

I installed Anaconda to start using pandas and matplotlib. However, Anaconda did not enable me to use them in the Pycharm IDE. I opened a command prompt and typed pip install pandas but it threw an error. I uninstalled everything: Anaconda, Pycharm, Python itself... and reinstalled everything. That didn't help at all. After installing Pycharm through Anaconda, it threw the same error: No Module Named 'pandas' I then tried the Spyder IDE in Anaconda, and importing pandas and matplotlib works perfectly. However, I then opened the Pycharm IDE in Anaconda, and when I run the same code it throws the same old error - ModuleNotFoundError: No module named 'pandas' Does anyone know why this is happening? Why can't I import pandas and matplotllib in Pycharm when it works just fine in Spyder?

Upvotes: 1

Views: 762

Answers (1)

DaveR
DaveR

Reputation: 2348

It is possible that you are not using the same python interpreter (and therefore virtual environment) and therefore pycharm is not able to import the packages simply because they are not there. Try to run this both in your pycharm and spyder console:

import sys
print(sys.executable)

and check if their path is exactly the same.

Upvotes: 1

Related Questions