Pylance Missing Imports Poetry Link [2026]

This is a common frustration for Python developers using Visual Studio Code. The issue usually stems from Pylance (VS Code's language server) not knowing where Poetry has installed your virtual environment, or not selecting the correct interpreter.

Here is a solid, actionable guide to fixing missing imports when using Poetry in VS Code.


1. Select the Poetry venv in VS Code (recommended)

List installed packages (ensure your import is here)

poetry show --tree

Now, open VS Code. Look at the bottom-left corner of the window. You’ll see the Python interpreter indicator. If it says something like Python 3.9.6 ('base') or Python 3.10 ('global'), that confirms Pylance is using the wrong environment. The fix is to point it to the Poetry environment.

Solution 1: Let Poetry Reveal and Select the Interpreter (Simplest)

  1. In your terminal (inside the project directory), run: pylance missing imports poetry link

    poetry env info --path
    

    This outputs the absolute path to Poetry’s virtual environment (e.g., /Users/me/Library/Caches/pypoetry/virtualenvs/my-project-abc123-py3.11).

  2. In VS Code, open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P). This is a common frustration for Python developers

  3. Type Python: Select Interpreter.

  4. Click Enter interpreter path... and paste the path you copied, appending the appropriate Python binary: Find your Poetry venv path: poetry env info --path

    • macOS/Linux: bin/python
    • Windows: Scripts\python.exe

    Example full path: /Users/me/Library/Caches/pypoetry/virtualenvs/my-project-abc123-py3.11/bin/python

  5. Reload the VS Code window (Developer: Reload Window). Pylance will now index the correct environment.