[Python] Why Python imports cannot be resolved by Pylance in VS Code, if the package is...

Discussão em 'Python' iniciado por Stack, Agosto 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am using Pylance extension in VS Code. Some packages import cannot be resolved by Pylance. I found out that these packages are located in a shared folder and the UNC Path of this folder is in the PYTHONPATH (environment variable).

    All the non-UNC Path in the PYTHONPATH are correctly treated by Pylance.

    The python code is running correctly.

    So I want Pylance to correctly treat the packages in the shared folder.

    I tried : from mail import Mail

    And I have this in Pylance : Import "mail" could not be resolved Pylance(reportMissingImports) [Ln 16, Col 6]

    To check that the UNC Path in PYTHONPATH was the issue, I copied the packages and pasted them in a local folder. Then I added the local folder path in PYTHONPATH and Pylance was able to correctly resolve the imports.

    Continue reading...

Compartilhe esta Página