Philip Pyle
Philip Pyle

Reputation: 1

python won't recognize Pandas

I have python 3.10.4 installed and running perfectly fine, but was given a bigger assignment that seems best suited for pandas. I installed PyCharm (2022.1 Community edition, v11.0.14.1) and that seems to work fine.

I did all the steps to install pandas (ver 1.4.2) and it seems to be in place but no matter what I do as soon as I import it in to my program import pandas as pd

I get the error: no module named pandas

while in PyCharm, I do have the pandas package in place for the current project, but nothing seems to be working

Upvotes: 0

Views: 482

Answers (1)

Kashish Bhatia
Kashish Bhatia

Reputation: 36

I believe the problem is with either interpreter or run configuration.

Let's elaborate on that, shall we?

First of all check at the bottom if you have a python interpreter associated with your current project: I have a venv python environment associated with the project

If you do too then perform these steps:

  1. Click on it and then select interpreter settings
  2. It will take you to the Interpreter Settings screen and you will be able to check all the installed packages in the associated (venv) environment or System python interpreter, depending on what is associated with your project.
  3. Nonetheless, check if you have pandas installed in the list if not use "+" button to do so.

Run Configuration:

  1. If in the above steps you found out that pandas was already installed, that means you are using the wrong environment in "run configuration"
  2. From the drop-down select edit configuration, and select the configuration you are trying to run. Edit Run configuration
  3. You will see an option "Python Interpreter", using the drop down use the same python (exact same name from the previous step) you checked in the previous step which was having pandas installed. Apply/OK and try to run script again.

Upvotes: 1

Related Questions