Pylance in Visual Studio Code not detecting Pandas (already installed)

72 Views Asked by At

I'm encountering an issue with Pylance, the language server for Python in Visual Studio Code. Despite having the pandas module installed in my Python environment, Pylance is reporting

Import "pandas" could not be resolved from source--Pylance(reportMissingModuleSource).

Additional Information:

Visual Studio Code version: 1.74.3
Python extension version: v2022.20.2
Pylance version: v2023.5.30
Pandas: 2.0.3
Operating System: Ubuntu 22.04 LTS

Here are the steps I've taken so far:

  • I've verified that pandas is installed in my Python environment. When I run my code, it works without any issues.
  • I've tried restarting Visual Studio Code, reinstalling the Python extension, but the issue persists.
  • I've ensured that the correct Python interpreter is selected for my project.

Despite these efforts, Pylance still cannot detect the pandas module.

Any suggestions on how to troubleshoot or resolve this issue would be greatly appreciated. Thank you!

1

There are 1 best solutions below

0
MingJie-MSFT On

If you ensure that you've chosen the correct python interpereter, you could add the following codes to your settings.json:

"python.analysis.extraPaths": [
    "/path/to/directory/where/pandas/is/installed"
]