Closed karrtikr closed 5 years ago
Hi, I am experiencing a similar problem. Even after setting up the .env file with PYTHONPATH, I am not able import modules in the subdirectories of the project. For now, I have to explicitly append the path of the root folder in the python file. Is there a way to globally set the PYTHONPATH to the project folder, when using "run python file in terminal".
At the moment, our current recommendation is to use the extraPaths
configuration 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-warnings
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.
@potens1 commented on Tue May 21 2019
Environment data
Expected behaviour
The python extension should be able to use the virtualenv, including packages installed in dev mode
Actual behaviour
Errors about import of packages and errors about undefined variables
systemd package is not system wide installed, only in the virtualenv and it is found by the extension
Steps to reproduce:
pip install -e
(orpipenv install -e .
)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
)Nothing relevant to me but...
``` [Violation] Added non-passive event listener to a scroll-blocking@karrtikr commented on Wed May 22 2019
Please create a
.env
file in the root directory with contentPYTHONPATH=./src
, and see if that resolves the warnings.@potens1 commented on Wed May 22 2019
Hi, I created it, tried with
.src
,./src
, orsrc
, and no, it does not change anything. By the way, in mysetup.py
, thepackage_dir
already specify where to find the package (if this should/could be understood by the extension)Thank you
@karrtikr commented on Wed May 22 2019
Setting
PYTHONPATH=./src
and reloading is expected to findsandbox
. Moving this issue, please follow up in the mentioned link.