skip to Main Content

I created the library to simplify a work-related problem.

I followed the step-by-step process and successfully created the library. I used pip install on my machine (without virtual environments), and when I checked with pip list, everything seemed fine. However, when I try to use it in my code, I encounter the following error:

Import "x" could not be resolvedPylancereportMissingImports

I imagine that the library is installed, and the folder and file paths are correct. I used Twine to upload the files to PyPI, but I’m not sure what might be causing the issue. I’ve done extensive research and tried various solutions to resolve the error.

UPDATE:
I still can’t solve my problem. I tried setting the "python.analysis.extraPaths" but it didnt work. I did another library project to compare the result and I had the same problem. After downloading the library, Pylance doesnt recorgnize it, as if I hadnt downloaded it.

2

Answers


  1. Pylance is a linter, have you tried actually running your code to see if it works? If it works, then the issue is Pylance related. You can use the method from this issue: https://github.com/microsoft/pylance-release/issues/2478 to try and get it to recognize your library. If it doesn’t work with either Pylance or executing the code, find where your library is installed and make sure the site-packages are part of your path.

    Login or Signup to reply.
  2. Have you check your python interpreter?

    This error was usually caused by incorrect python interpreter.

    You could use shortcuts Ctrl+Shift+P and type Python: Select Interpreter to choose your correct python interpreter.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search