'reportMissingImports Python error but import works fine

When I install package with python and import it, I often get a missing imports message such as:

Import "fastapi" could not be resolvedPylancereportMissingImports

The imports always work perfectly fine, the fastapi example above will run a server and I can build an API without issue.

Can anyone explain why I am getting this error and how I could get rid of it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source