-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
installed_check script fails in mulit-root workspace with virtual environment #22460
Comments
@karrtikr it looks like we are getting the wrong python path here? |
It does not look like the path to interpreter is valid. Either use './.venv' or use ${workspaceFolder}/.venv notation to configure relative interpreter paths, the latter is preferred especially in a multiroot scenario. |
Thanks for your help with this! In my experience, Does I’ve struggled a bit to understand what this script does and what it’s requirements/expectations are. Would it be reasonable to have |
I was reassured to see that I can copy the command that is run and execute it from the workspace folder (as the working directory) and it is successful: one$ .venv/bin/python ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/installed_check.py /private/tmp/workspace_root/one/requirements.txt
[{"line": 0, "character": 0, "endLine": 0, "endCharacter": 6, "package": "pytest", "code": "not-installed", "severity": 3}] My conclusion is that the only missing piece is ensuring that the spawned process is appropriately using the workspace folder as the working directory (similar to how the language server, test discover/execution, etc. do). |
Unfortunately due to technical reasons and simplicity of implementation, that is not possible for now, especially when there're reliable ways to correctly specify relative paths. The thing which makes it difficult it's up to the each tool how that is interpreted, which can be unpredictable (imagine a tool using Python extension which we do not control). If there's an issue with supported functionality do let us know and we'll happy to have a look again, closing for now. |
Thanks for your message @karrtikr. I have a different interpretation of this issue, the configuration options of the extension, and the documented expectations for
I don't see "multiple tools" at play here. I believe that As a matter of fact, the vscode documentation (the extension's documentation?) provides an example (emphasis is mine) that's identical to the one described in this issue (the documentation does say "full path", but it's clear that does not mean "absolute path" in the context of the provided example):
I believe I was actually inspired by this example when I configured my workspace and my setup has been generally well supported by the extension (other than in the case of
I'm sorry, but it's not clear to me what "technical reasons" would prevent two parts of the same extension ( Other parts of the same codebase seem quite capable of doing resolving the interpreter path relative to the workspace folder:
It seems to me that
My general concern is that as a user of It's clear that Thanks anyway for your consideration. I hope you may reconsider a fix here to improve the consistency of handling |
Reopening as we should correct the docs if we don't support this scenario. Is there a reason why the other notations do not work for you? |
Thanks, @karrtikr! However, I think it would be more accurate to say that the extension does support this scenario in every area I've found exception this one. That's why I suspect fixing
I honestly wasn't worried about them when you first made the alternative suggestions, however I've tested them and they resulted in the same failures as my original syntax:
NOTE: multiroot workspaces explicitly call out the value of and their support for using relative paths so that the same All of these results continue to suggest that in order to support multiroot workspaces like the rest of the extension, |
Thanks for getting back, let's look at each concern one at a time: For multiroot workspaces, try using notation mentioned here #18650 (for eg.
"Relative paths for folder section" to be exact, settings section are not resolved that way.
As I noted earlier, there could be more scenarios easily, we cannot force every tool to use workspace folder as their
That is, this is not guaranteed, we allow users to customize their own |
If |
I don't see how that will work for the folder defined as
How could one refer to that specific folder (
Exposing a customizable
I actually disagree with the conclusions drawn in that comment. I don't see any ambiguity in the given example. The config would simply point to a file relative to each folder and the designated file simply doesn't exist in
I've been a little confused about what you mean by "every tool"... I think you're referring to the different sub-components of the I don't really propose "forcing" anything (it implies perfect compliance, which isn't realistic), but I do advocate for something akin to "eventual consistency" - aligning as a team on a single shared solution to a common problem. It seems to me that sharing logic is probably beneficial for the team to avoid conflicting, diverging, or redundant code maintenance overhead. Is there a shared and recommended "resolve the interpreter path" code pathway that all tools in the extension can/should be using given that they all share the I would certainly be willing to use |
Not necessarily, it can be different tool extensions.
That's actually a bug, should be solved with: #22452. Reading settings using |
I've opened #22472 on your behalf to support resolving |
I see what you mean. I've definitely been focused on intra-extension interpreter path resolution consistency.
That will be a helpful fix to have!
Thank you very much, @karrtikr! I was feeling a little unsure of where to go next with my concern since the only solution path I feel confident enough about was within |
Type: Bug
Behaviour
Expected vs. Actual
I expect no exceptions to be raised when provided wth a valid python interpreter path and requirements file path.
Instead, I see an error (see logs below)
Steps to reproduce:
python.defaultInterpreterPath
to.venv/bin/python
python -m venv .venv
(with that folder as the working directory)requirements.txt
in the folderRepro multi-root workspace:
workspace_root.zip
Diagnostic data
python.languageServer
setting: PylanceOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.20.0
VS Code version: Code 1.84.2 (Universal) (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:52:33.687Z)
OS version: Darwin arm64 23.0.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: