Issue
I am using vscode with virtual environment (conda) to write python files on my mac.
I keep seeing import problems from pylance for specific third party AND official libraries (for example pyproj, geopy for third party, math for preinstalled).
for each file the errors/warnings look as follows:
I am sure that these packages are in my virtual environment (they are included in the conda list
packages.
Although so far it seems to me as a cosmetic issue, removing these warnings would be very helpful.
Here (https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings) there are some explanations but I did not fully udnerstand the issue or managed to resolve.
Solution
Add the following configuration in setting.json to remove these warnings
"python.analysis.diagnosticSeverityOverrides": {
"reportMissingImports": "none",
"reportUndefinedVariable": "none"
},
Use ctrl + shift +p
to open the command palette. Search Settings, there are two settings.json files here. User works globally, Workspace works only on the current workspace. If the same configuration exists in both files, Workspace will override the settings in User.
Answered By - JialeDu Answer Checked By - Pedro (WPSolving Volunteer)