You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mypy-type-checker.path is configured to use a user-controlled version of mypy instead of the bundled one, it is invoked with the PYTHONPATH env var set to include the extension's bundled python dependencies which causes mypy to return unexpected results as it loads dependencies from the bundled libs in preference to venv or system equivalents.
Configuring this setting with a shell stub to print environment such as
We need to add a check to verify that the mypy provided via path succeeds. If not, then we can leave an error log. Attempting fallback with PYTHONPATH can lead to same problem of loading packages from the wrong place.
FWIW this issue can be worked around by VS Code settings similar to:
"mypy-type-checker.path": [// Workaround for https://github.com/microsoft/vscode-mypy/issues/217"/usr/bin/env","--unset=PYTHONPATH","${workspaceFolder}/.venv/bin/mypy",],
When
mypy-type-checker.path
is configured to use a user-controlled version of mypy instead of the bundled one, it is invoked with thePYTHONPATH
env var set to include the extension's bundled python dependencies which causes mypy to return unexpected results as it loads dependencies from the bundled libs in preference to venv or system equivalents.Configuring this setting with a shell stub to print environment such as
reveals
in the extension's output panel.
The extension setting
importStrategy=fromEnvironment
is affected by a similar bug: microsoft/vscode-black-formatter#369The other VS Code extensions for black, isort, pylint do not set
PYTHONPATH
and so are correctly isolated from the LSP server python environment.The text was updated successfully, but these errors were encountered: