-
Notifications
You must be signed in to change notification settings - Fork 1.2k
language server cannot resolve import with editable mode package #4954
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
Comments
PS: package installed directly(without |
should i move the issue to language server repo issue tracker? |
I have exactly the same issue with |
I'm experiencing this problem as well, but I couldn't find a related open bug against the language server. |
I fixed microsoft/python-language-server#989 a few weeks ago; the editable installs were breaking due to a bug. This issue can probably be closed. (The example given here was used in my testing.) Note that the language server still needs configuration via extraPaths or PYTHONPATH to point to import roots, they aren't automatically detected. |
@jakebailey, I'm using languageServer.0.3.21 and my editable installs are still unresolved. I've tried adding them as "python.autoComplete.extraPaths" both in the user settings and the workspace settings. (On a side note, I understand that not using extrapaths is a big technical challenge, but I anticipate that requiring them is going to be a source of headaches. Jedi does not seem to require them). Please let us know if I am not the only one who still has these issues? Thanks. |
I'm not sure about your specific case, I was referring to this specific issue, which was transferred to our tracker as issue 989. I'm assuming you're looking at microsoft/python-language-server#918, which I'm still looking into. I'd appreciate your test case there (as I had assumed by the reactions in the thread that things were fine). From what I've observed, Jedi has a very different import finding mechanism that ends up being much, much more loose than the stricter one used in the language server. |
@jakebailey I think I figured out what my problem was. One of the paths in my list of "python.autoComplete.extraPaths" was 1 level too high (from when I was naively trying to not have to list every single editable package path...). That seems to invalidate all the other valid paths :-( As I anticipated, this is going to be a source of pains. Also if, as we do, one switches back and forth between editable and non-editable installs, one has to bother to be careful about updating the extrapath. Jedi seems to resolve the installed package, the one that the interpreter will use (editable or not); but the language server will resolve whatever is in the extrapath, which might be code that actually will not run. Finally, when importing from a script in the same folder, I'm now forced to add the relative path ( Sorry if I don't illustrate this very well, but I have deadlines to meet and I can't dedicate more time to this for now. |
I am getting the same error mentioned by the OP as well. |
Please try to see if this is fixed with the latest version of the Language Server. If not, please file an issue giving more information here: https://github.com/microsoft/python-language-server/issues/new/choose |
Environment data
Expected behaviour
vscode can go to my package's definition
Actual behaviour
unresolved import 'namespaced.b'
Steps to reproduce:
pip install package_a; pip install -e package_b; pip install -e package_c
-e
option cannot resolved by language server.Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)The text was updated successfully, but these errors were encountered: