How to configure VSCode with pylance so that I can change conda environments?

68 Views Asked by At

When I use VSCode with pylance, if I change conda environments I get the

overriding the stdlib module ... Pylance (reportShadowedImports)

warning.

There are lots of posts about this (e.g. https://github.com/microsoft/pylance-release/issues/5191). Most of which suggest disabling the "reportShadowedImports":

"python.analysis.diagnosticSeverityOverrides": {
    "reportShadowedImports": "none"

Is there a way to configure VSCode with pylance so I can switch conda environments, not disable "reportShadowedImports", and not get the "overriding the stdlib module...Pylance (reportShadowedImports)" warnings?

1

There are 1 best solutions below

0
MingJie-MSFT On

I found a comment in this issue.

You could rename your code.py to main.py so that it doesn't conflict. It will still be loaded on boot.