4

I have upgraded my VS Code to the latest version, 1.30.0. Then it starts to complain about unresolved import. This is because my work uses docker, so docker image contains all the dependencies while my local machine doesn't. I don't want to install all the packages locally. Is there any way I can disable that errors/warnings?

The output looks like warnings, as there is a yellow triangle at the beginning with text like

[Python] unresolved import 'freezegun'

I have tried to set log level to error, and set python.analysis.disabled to unresolved import, but nothing works. Probably I did something wrong.

Jerry
  • 300
  • 1
  • 3
  • 10

2 Answers2

5

Adding "python.analysis.disabled": ["unresolved-import"], in settings solves this.

Jerry
  • 300
  • 1
  • 3
  • 10
1

Above answer didn't work for me because there was no such option python.analysis.disabled (vscode version 1.63.2)

1. Solution

Current solution could be found at this answer (more in depth). In short add this to settings.json

"python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none"
},

2. Another Workaround

Another quick workaround is to use regex filter and negate it using ! For example: !import will show every match that does NOT contain word import

enter image description here


3. Using Docker Environment

To address the issue of Docker containing all dependencies, consider using the Remote - Containers extension by Microsoft. This extension allows you to open projects within a container and use the container's environment.

The Remote - Containers extension lets you use a Docker container as a full-featured development environment.