'Import pandas could not be resolved from source Pylance(reportMissingModuleSource)

I've been trying to use the packages pandas, numpy, matplotlib, seaborn in my "Visual Studio Code", but the program keeps showing me the following message:

"import pandas could not be resolved from source Pylance(reportMissingModuleSource)"

Previously to Visual Studio Code I installed "Anaconda" to use Jupyter, and now it says that i have the existing packages (pandas, numpy...) but keeps appearing this message that doesn't allow me to use pandas in my Visual Studio.

Anyone could help me to solve this issue?

I tried installing again all the packages to check if they didn't exist but apparently are installed all of them but in another route. I can't find how is the way to put them so the Visual Studio Code recognizes them and I can use them.



Solution 1:[1]

I also received similar an error on my IDE VSCode and currently using mac m1 .First we need to make sure that the python3 interpreter version from terminal version is the same with our python version selection in VSCode.

  1. open terminal.
  2. type 'python3'
  3. then you will see your python version.(my python3 version is 3.9.12)

python3 version

  1. open your IDE VSCode

  2. open any/current folder that related to python project on IDE VSCode

  3. Check your python version at the bottom right on IDE VSCode (in my case the python version is 3.10.64)

  4. change or switch VSCode python version from 3.10.64 to 3.9.12 (same with your python version on your pc)

  5. done

Solution 2:[2]

I re-entered the path to Python interpreter and warning disappeared. Hope that helps you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 khoi
Solution 2 Damian