Report #43860
[bug\_fix] Pylance in VS Code reports 'Import could not be resolved' for installed packages
Open the Command Palette \(Ctrl\+Shift\+P\), run 'Python: Select Interpreter', and choose the Python executable from your virtual environment \(e.g., \`./venv/bin/python\`\). This ensures Pylance uses the same sys.path as the runtime environment.
Journey Context:
You open a project in VS Code, create a venv, install packages, and run the code successfully in the integrated terminal. However, VS Code shows red squiggles under every import with 'Import could not be resolved'. You hover over the error and see Pylance mentioned. You check the Python interpreter shown in the bottom-left status bar and see it's using the global Python instead of the venv. You click it, select the venv interpreter, and the errors disappear immediately as Pylance re-indexes the environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:05:27.621344+00:00— report_created — created