You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Extension version (available under the Extensions sidebar): 2019.4.12954
OS and version: Windows 10 v. 1809
Python version (& distribution if applicable, e.g. Anaconda): 3.5.2 64-bit without Conda
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): I guess I have no venv set up.
Relevant/affected Python packages and their versions: Microsoft Python Language Server v. 0.2.86
Actual behaviour
I open VSCode in a root folder where all my code exists. Part of it looks like this:
workspaceRootFolder
.vscode
network
section_network_input.py
timepredictionslib
build
dist
timepredictionslib
Here in subfolders are all my classes in the module
.env
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
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.
I just recreated the issue based on the original project with the same exact folder structure. https://github.com/chudytom/LangServerError
However my guess is, that the library is somehow installed and that's why it's discovered byt the Python interpreter but the Language Server can't find it.
Yes, I used pip install -e a long time ago. Looks like it's still under effect. Is there any way I can still use my own develop library and the Python Language Server at the same time?
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.
I'm going through all of these cases. For both of these test repos, you can set extraPaths in order to tell us more directories to consider as import roots.
(There is no sectionnetwork in that repo so those get squiggled.)
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).
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.
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: "python.analysis.downloadChannel": "daily"
and reinstalling the Language Server this way: microsoft/vscode-python#3977
Activity
rdrey commentedon May 29, 2019
I was just busy creating this repo to reproduce this issue: https://github.com/rdrey/langservtest
chudytom commentedon May 29, 2019
I just recreated the issue based on the original project with the same exact folder structure.
https://github.com/chudytom/LangServerError
However my guess is, that the library is somehow installed and that's why it's discovered byt the Python interpreter but the Language Server can't find it.
jakebailey commentedon May 29, 2019
Are you using editable installs for those packages during development? (i.e.
pip install -e .orsetup.py develop)There are a set of known issues with editable installs. (See the editable-install issue label)
chudytom commentedon May 29, 2019
Yes, I used
pip install -ea long time ago. Looks like it's still under effect. Is there any way I can still use my own develop library and the Python Language Server at the same time?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.
rdrey commentedon May 30, 2019
Yeah, our package is editable, too.
jakebailey commentedon Jun 7, 2019
I'm going through all of these cases. For both of these test repos, you can set
extraPathsin order to tell us more directories to consider as import roots.Rainer Dreyer (@rdrey)
Tomasz Chudzik (@chudytom)
(There is no
sectionnetworkin that repo so those get squiggled.)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).
jakebailey commentedon Jun 7, 2019
At the moment, our current recommendation is to use the
extraPathsconfiguration to point the LS to your import roots. See the new documentation here: https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#unresolved-import-warningsA 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:
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.
chudytom commentedon Jun 10, 2019
I updated my repository to correct files included. https://github.com/chudytom/LangServerError
Here I'm not able to make the Language Server working with any extraPaths.
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:
"python.analysis.downloadChannel": "daily"and reinstalling the Language Server this way:
microsoft/vscode-python#3977