-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import could not be resolved #3452
Comments
Please refer to this documentation in the troubleshooting section. |
Thanks, I had success using the following command: pip install -e . --config-settings editable_mode=compat However, there is a warning:
So static analysis tools, like Pylance, need to adapt to these new-style editable installs, i.e. dynamic .pth files. |
Unfortunately PEP 660 was approved without discussion with the Python typing community. We cannot run import hooks. But there has been discussion about alternative ways to solve this problem. See this typing-sig thread. If a solution is found, agreed upon by typing-sig, and standardized, Pylance will consider supporting it. Note that the |
Thanks for the explanation and the references. You're doing good work! |
Environment data
Code Snippet
Expected behavior
Module is parsed correctly.
Actual behavior
Pylance shows an error:
Import "experitur" could not be resolved
python
executes the file normally.Additional info
experitur
is editable installed from a local git clone (pip install -e .
). The weird thing is that other editable modules just have avenv/lib/python3.10/site-packages/__editable__.XXX.pth
file which contains just the location.experitur
, however, has two files (__editable___experitur_1_1_0_178_g937611e_dirty_finder.py
and__editable__.experitur-1.1.0+178.g937611e.dirty.pth
) and the.pth
file seems to be actually a Python file. This seems to be the only difference between the working and non-working editable installs.Putting the package root into
python.analysis.extraPaths
helps.The only noteworthy entry in the Python Language Server log is:
(
zoomie2.py
is the file containing the import statement.)The text was updated successfully, but these errors were encountered: