-
Notifications
You must be signed in to change notification settings - Fork 1.2k
python.DefaultInterpreterPath
not respected in multi-root workspace.
#18207
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
Hi @urscion, thank you for reaching out. There are 2 things here:
There's a bug where we don't resolve
I could not replicate your issue here, when I set a valid interpreter path in my Does interpreter selection work correctly for you in non-multiroot workspaces? |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off. |
I'm also experiencing this problem. Would it be possible to re-open this issue @brettcannon? The @kimadeline wrote:
Interpreter selection seems to work fine in non-multiroot workspaces. It works inconsistently in multi-root workspaces. Sometimes selecting interpreter from the dialog does nothing. When it works, it's not clear where this information is stored as it's not saved in the @kimadeline wrote:
Is there an issue already for this? It would be nice to be able to define - "python.defaultInterpreterPath": "/Users/ome/Code/orgs/indico/indico-un/.venv/bin/python",
+ "python.defaultInterpreterPath": "${workspaceFolder:indico-un}/.venv/bin/python", |
Hi @OmeGak,
Please provide repro steps, and ideally, a test repo I could use to try and replicate the issue on my end.
Support for |
Hi @kimadeline. Let me know if you can reproduce with these steps.
Additionally:
The feature exists (https://code.visualstudio.com/docs/editor/variables-reference#_variables-scoped-per-workspace-folder) but it's not clear to me if it's available everywhere. |
Thank you for providing a test repo and steps!
The only Python environment available is in If you want As for multiroot-workspace variable scoping, the extension does not support that at the moment. Feel free to open a feature request (and upvote it) to gauge community interest! |
Thanks for your response @kimadeline!
It was my impression that "python.defaultInterpreterPath": "${workspaceFolder}/../.venv/bin/python"
This would nicely solve my real use case, which looks more like this:
To make it work with "python.defaultInterpreterPath": "${workspaceFolder}/../python-a/.venv/bin/python" If multiroot-workspace variable scoping were available I could do the following instead: "python.defaultInterpreterPath": "${workspaceFolder:python-a}/.venv/bin/python" Should I propose this in https://github.com/microsoft/vscode-python or https://github.com/microsoft/vscode? |
Glad to hear it woks now! And feel free to open this feature request on this repo (https://github.com/microsoft/vscode-python), and link to your comment above 🙂 Thank you! |
VS Code version
1.63.2
Extension version
v2021.12.1559732655
OS type
Windows
OS version
19043.1348
Python distribution
python.org
Python version
3.9.1
Language server
Pylance
Expected behaviour
When I set
python.defaultInterpreterPath
in my workspace configuration file, the Python extension should use that interpreter.Actual behaviour
The "Choose a Python Interpreter" selection is shown and no interpreter has been selected.
Steps to reproduce
code-workspace
settings fileWhen attempting to clear the workspace interpreter setting (off a fresh restart) and resetting it via the command palette prompts, it does not work either.


Logs
And these are the results of my Python output. It appears to be not respecting the pre-defined
${workspaceFolder}
variable. However, I've tried an absolute path as well, as well as my system-level Python paths and they do not work either (but no scandir errors are displayed).Results
Code of Conduct
The text was updated successfully, but these errors were encountered: