-
Notifications
You must be signed in to change notification settings - Fork 133
Python unresolved import issue #1137
Comments
I was just busy creating this repo to reproduce this issue: https://github.com/rdrey/langservtest |
I just recreated the issue based on the original project with the same exact folder structure. |
Are you using editable installs for those packages during development? (i.e. There are a set of known issues with editable installs. (See the editable-install issue label) |
Yes, I used When I looked through the issues with editable-install label the only recommendation I saw is to uninstall the library, but I guess I want be able to modify the library, then. |
Yeah, our package is editable, too. |
I'm going through all of these cases. For both of these test repos, you can set (There is no I'm aware that there are issues when this is mixed with editable installs, but I'm just trying to narrow down what the solution is going to be at the moment (less strict imports vs configuration for extra roots). |
At the moment, our current recommendation is to use the A fix to editable installs was merged in #1183 (v0.3.1+), and will be available in the daily download channel shortly (and stable likely after). To switch to this for testing, you can set: "python.analysis.downloadChannel": "daily" Inferring this information automatically is more difficult than it seems, but there is likely work that can be done on that front in the future. |
I updated my repository to correct files included. https://github.com/chudytom/LangServerError However with the new fix #1183 (it still needs to be combined with extraPaths) everything seems to work smooth. The working version of the Language Server is 0.3.3 The new version can be installed by setting: |
@chudytom commented on Sun May 26 2019
Environment data
Actual behaviour
I open VSCode in a root folder where all my code exists. Part of it looks like this:
In the 'network' folder I have some script that I run straight from PowerShell whereas in 'timepredictionslib' I have my custom module where I store all reuasuable classes.
All code runs smooth when run by the Python interpreter, however when I disabled Jedi and switched to Microsoft Python Language Server I get the 'unresolved import' error

I already added the '.env' file with the following content:
PYTHONPATH=timepredictionslib
and added the file as python.envFile as was advised here:
microsoft/vscode-python#3840 (comment)
Also I added python.autoComplete.extraPaths as was proposed here:
#1099
But none of these helped. Do you guys have any idea what else I need to do for the Lanugage Server to discover my library?
One more thing. When I tried to update the first import presented in the attached screen it is then discovered by the Language Server and IntelliSense but not by Pylint and the Python interpreter:

Steps to reproduce:
If needed I will create a smaller project with similiar configuration and push it to GutHub.
Logs
Output for

Python
in theOutput
panelsettings.json for Python
The text was updated successfully, but these errors were encountered: