-
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
Provide a way to explicitly tell the extension to automatically pick interpreter from PATH #12665
Comments
Thank you for the suggestion! We have marked this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes the opening comment gets to help us make our decision. |
good suggestion |
Thanks for the suggestion! We talked about it with the team and we have unfortunately decided we will not be moving forward with this idea. We think there isn't an enough widespread need for this to warrant the maintenance cost for the feature. |
Hello, at my workplace we are switching over to use nix for our development environments and we just discovered the same issue with using vscode. This feature would be very helpful so we can use different versions of python in different circumstances. |
Some context
Currently using nix to create versionable environments for my projects. I enter the environment (using
nix-shell
) and then launchcode
from inside this environment. The environment provides apython
interpreter via thePATH
environment variable. Thispython
interpreter comes packed with all the python projects dependencies. The interpreter is located in the nix store:/nix/store/4qp2kldp8pn912gdsiawxkvyh6dajlpw-python3.5-python35-interpreter/bin/python
. This path changes for any tiny change to the interpreter of its dependencies (including system dependencies of the python interpreter or any of the python dependencies which are also delivered by nix).The problem
At some point in the past (before the extension being taken over by ms) specifying
python.pythonPath = "python"
was enough for nix env interpreter being picked by vscode. However, at some point it stopped working properly (selecting the python from the system or venv instead ofPATH
). After some search and experimentation, I discovered that specifying insteadpython.pythonPath": "${env:NIX_PYTHON_INTERPRETER}"
was a workaround.This is however a bit awkward and redundant as it forces me to define the
NIX_PYTHON_INTERPRETER
environment variable as part of theshellHook
of each of my nix env.Also, for most projects I work on, all developers use nix and as such we generally like to be explicit that for this particular project, we want vscode to automatically pick the
python
interpreter fromPATH
(as provided by the nix env). This is why we generally set${env:NIX_PYTHON_INTERPRETER}
in the project's.vscode/settings.json
but would have instead preferred to only specifypython.pythonPath = "python"
or any other expression that tells vscode to take the interpreter fromPATH
.As a sideline, if I understood well, I learn that this might no longer be possible to specify this settings as part of
.vscode/settings.json
nor workspace settings. See Queries about moving workspace pythonPath setting into VSCode storage · Issue #12313 · microsoft/vscode-python for some context.Note that this issue is really about a way to reliable pick the interpreter from
PATH
and the possibility to be explicit about it and ideally that his can be specified on a per project basis, optionally version controlled.The text was updated successfully, but these errors were encountered: