[{
"resource": "/d:/Users/Home/Desktop/Python/estudos/pratices.py",
"owner": "_generated_diagnostic_collection_name_#0",
"code": {
"value": "reportMissingModuleSource",
"target": {
"$mid": 1,
"external": "https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingModuleSource",
"path": "/microsoft/pyright/blob/main/docs/configuration.md",
"scheme": "https",
"authority": "github.com",
"fragment": "reportMissingModuleSource"
}
},
"severity": 4,
"message": "Import "pandas" could not be resolved from source",
"source": "Pylance",
"startLineNumber": 1,
"startColumn": 8,
"endLineNumber": 1,
"endColumn": 14
}]
is the message given
the cmd shell tells me i have all the libraries i want installed and they’re in the project folder, i’m running a virtual environment but whenever i try to run something in a .py file, it says that it’s not defined, i have installed anaconda but don’t mean to use it right now, if i open a jupyter file it’ll import no problem, but trying to run pip doesn’t work at all
reinstalling vscode, making sure python’s installed, making sure pip is installed
2
Answers
I had a similar issue before and the solution I found is that you have to make sure the python interpreter for the current VSC window is your virtual environment instead of the system-wide python interpreter. On windows:
You should make sure that the current interpreter and the
pandas
library installed are the same interpreter environment.The current interpreter can be output with the following code.
Then install the
pandas
library with the resulting interpreter path.