Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylance does not recognise newly installed pip packages

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?

like image 849
Harry Stout Avatar asked Feb 02 '26 16:02

Harry Stout


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.

like image 150
Molly Wang-MSFT Avatar answered Feb 04 '26 06:02

Molly Wang-MSFT


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

like image 44
William Riddle Avatar answered Feb 04 '26 06:02

William Riddle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!