VS Code shows 'Import could not be resolved' even though the code runs
@devsingh05▲ 10 net votes
Pylance is analysing with a different interpreter than the one you installed packages into. Run 'Python: Select Interpreter' from the Command Palette and pick the project's .venv (or the uv/poetry environment). For a new venv, reload the window. The status bar shows the active interpreter; terminal sessions opened before creating the venv also keep the old one.