Pylance does not recognise newly installed pip packages

Viewed 2584

I am getting the following error while trying to import newly installed packages from pip:

Import "<package>" could not be resolved Pylance(reportMissingImports)

After I restart VS code, Pylance seems to then be able to recognise the package.

Is there any fix to this as it is very annoying!

2 Answers

This question will happen when Pylance doesn't detect the module immediately. You may Reload Window from Command Palette to refresh the current project.

If you are using VS Code, open the command pallet and run "Python: Restart Language Server"

Related