Python language features do not work with libraries installed in Poetry local virtual environment (.venv)
01:28 03 Aug 2025

I have a Python Poetry project. Visual Studio Code features like auto-import and auto-complete do not work for the project dependency libraries. Pylance (the Python language server for Visual Studio Code) does not find dependencies, and they are highlighted with red underlining.

enter image description here

Python interpreter is correctly configured and selected. How to fix?

In the Visual Studio Code console Pylance reports:

2025-08-03 08:25:50.202 [info] (6995) Auto-excluding **/node_modules
2025-08-03 08:25:50.202 [info] (6995) Auto-excluding **/__pycache__
2025-08-03 08:25:50.202 [info] (6995) Auto-excluding **/.*
2025-08-03 08:25:50.202 [info] (6995) Assuming Python version 3.11.10.final.0
2025-08-03 08:25:50.293 [info] (6995) Found 3 source files
visual-studio-code pylance