ModuleNotFoundError: No module named 'pandas' when import pandas

Ali Mahd 26 Reputation points
2020-07-30T16:04:18.197+00:00

I have installed Anaconda and pandas are installed in a particular directory location. However when I run my Python script in Visual Studio Code the "import pandas as pd" returns the error above. Do I have to install pandas in another location next to Python.exe? If so how? I have tried installing pandas again in Anaconda and it returns with message that requirement already satisfied. I cannot run "pip install pandas" from CMD. It does not recognise pip as an internal or external command.
I will be grateful if you can help.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
35,985 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Evan Chatter 11 Reputation points
    2021-04-12T04:42:44.223+00:00

    In most cases this error in Python generally raised:

    • You haven't installed Pandas explicitly with pip install pandas.
    • You may have different Python versions on your computer and Pandas is not installed for the particular version you're using.

    You can run the following command in your Linux/MacOS/Windows terminal.

    pip install pandas
    

    To be sure you are not having multiple Python versions that are confusing, you should run following commands:

    python3 -m pip install pandas
    python3 -c 'import pandas'

    0 comments No comments

  2. jose henrique dias ferreira 1 Reputation point
    2021-06-09T16:24:20.397+00:00

    Hello, if you still haven't solved it, I would ask you to check the version of your python, using the command "python -version" in your cmd, and then install the plugin using the same cmd as well, do this through anaconda prompt, make it be installed in an instance to use only anaconda if I'm not mistaken. After checking your python version, open your script using visual studio and if you are developing on a notebook, change the python version in the upper right corner, to a version greater than or equal to the one installed103943-screenshot-2.png

    To get pip to work on your cmd, try reinstalling your python by checking "add python version to PATH".

    HtYbw.png

    Hope to help!