-
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
Add the ability to disable the new DeprecatePythonPath feature #17693
Comments
Hi @jan11011977, thanks for providing feedback. The new setting should have the same behavior as For context, the Python extension will only prompt to select an interpreter if it doesn't recognize the one defined by
Are you able to share some steps so we can reproduce the issue? |
Hi @luabud, sorry for the late reply. My understanding is that python.defaultInterpreterPath is ignored if the user has already selected a valid Python interpreter. The trouble comes if the user has selected the wrong Python interpreter. We check a full Python install into source control, and we'd like VSCode to use that. however if a user selected a different (valid) interpreter for example one off their own machine, there is no way for us to correct that problem automatically. Please correct me if I have misunderstood how this works. |
Apologies for the delay in my response! Your understanding is correct. Our recommendation in this case is to not have the Python path checked into source control (i.e. remove the python.defaultInterpreterPath entry from .vscode/settings.json) for this not to happen, as rarely ever the path to the interpreter will be the same across different machines. However I will keep this issue open so I can talk to the team about it and make a decision. |
Thank you! As I mentioned, we check a python interpreter into source control. So the location is always the same (relative to the vscode workspace). We have a workspace with 7 different directories in, some of which require a different python interpreter than others. There is no way to view what interpreter each directory is currently set to, to check for mistakes. This makes it impossible to diagnose issues. Really this workflow has gone from brilliant (specify the python path in the settings), to completely unusable (manually have every user set all seven python paths). I hope there is something you can do about this issue. |
Sorry I do not understand this particular issue, given The behavior of the new setting is the same as the old one until an interpreter is manually changed for the workspace folder by the user using the "Select Interpreter" prompt. (docs)
Regarding the diagnosing issue which comes when a user decides to change an interpreter themselves, we actually log the interpreter in the Python output channel so you can potentially check there. We also expose an API using which you can detect this automatically. |
Thank you for your reply.
I did try setting the defaultInterpreterPath but I couldn't get it to work,
presumably it already had decided on a setting and it was too late to
override it.
Imagine the scenario where I am trying to set the defaultInterpreterPath
correctly. Maybe I set it incorrectly, I load the workspace, the incorrect
setting is saved. Now I try to change the setting and reload the workspace,
but the incorrect setting has already been "fixed". Or maybe it hasn't...
It's hard to say because there is no UI that shows me what is happening.
Another problem is if we want to move the location of the interpreter. This
is impossible because once the defaultInterpreterPath has been read, it
can't be changed.
What I would ideally like is a button in Visual Studio code that resets all
the python interpreter settings back to the default (inherited from the
defaultInterpreterPath). That would be a big help.
What would also be great is if we could see which python interpreter was
selected for each directory in a single place. For example, if you click
the 'select interpreter' button it brings up a menu asking you to select
which directory to choose the interpreter for. If in this menu it could
show the currently selected interpreter in small letters underneath each
menu option that would be a game changer.
…On Thu, Jan 6, 2022 at 6:03 PM Kartik Raj ***@***.***> wrote:
We have a workspace with 7 different directories in, some of which require
a different python interpreter than others.
This means every user has to click on “select interpreter”, then choose
the relevant directory and select the right interpreter for that directory.
And they have to do this for each directory, so seven(!) times.
Sorry do not understand this particular issue, given
python.defaultInterpreterPath is checked into source control, you can
simply specify the particular setting for each directory (which is opened
as a workspace folder), so users don't have to select it themselves. So
users would automatically get the correct interpreter to start with, can
you clarify?
The behavior of the new setting is the same until an interpreter is
manually changed by the user using the "Select Interpreter" prompt.
[image: image]
<https://user-images.githubusercontent.com/13199757/148428965-46e62278-892c-4fae-b20d-f8346480d476.png>
however if a user selected a different (valid) interpreter for example one
off their own machine, there is no way for us to correct that problem
automatically.
There is no way to view what interpreter each directory is currently set
to, to check for mistakes. This makes it impossible to diagnose issues.
Regarding the diagnosing issue which comes when a user decides to change
an interpreter themselves which you would like , we actually log it in the
Python output channel which can potentially work for you. We also plan to
expose an API using which you can detect this automatically.
—
Reply to this email directly, view it on GitHub
<#17693 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKXUUUCPTHASGIYRUAZVKTUUXKNNANCNFSM5FYBRPEQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@jan11011977 see if this workaround helps in your case:
|
Thanks for the quick reply.
The docs I mentioned earlier (doc) does mention a command
It doesn't get fixed as long as you don't use the "Select Interpreter" prompt UI. If you directly change the value of the setting, it should get picked up.
There're actually two UIs which shows the selected interpreter. One is here: and other is the
Sure, we can do that as part of this issue. Overall I understand the confusion, please give the TLDR section a fresh read, and let me know if it makes sense. |
Thank you this is really helpful. In the TL;DR it states: But I now see that it will continue to use the defaultInterpreterPath, unless the user explicitly chooses a different interpreter. Thank you for pointing that out. Using the 'Clear Interpreter Command' I managed to now get this working the way I want, which is fantastic. Showing the current interpreter path text in the select folder quickpick is also super helpful, thank you for adding that as well. The only remaining thing that would really helpful is to have a single command that clears all the selected interpreters. Right now I would have to tell our developers to run the clear command on all 11 folders (plus the workspace). If there was a single command to clear them all, I could then tell everyone "if you are having issues, please run this command and it will fix it". Thank you for the help |
Ok actually I have one more suggestion related to the "No Python interpreter is selected" dialog (see image below). It would be very useful if the dialog told you which folder it's prompting you to select a Python interpreter for. This might be obvious if you only have one directory open, but if you have a dozen directories open it's hard to know which one it's complaining about. |
Good to hear that most of your problems are solved and thanks for valuable feedback regarding doc.
There's currently a command called If you still need it, I'll see if I can add an option in that command to clear settings of all workspaces. |
This is also a great suggestion, but seeing as it's unrelated to the issue in hand, can you create a new issue for this? |
Fantastic! Thank you so much |
Created #17667 to track #17693 (comment). |
many large orgs use tooling to ensure consistent environments. not being able to check in tooling configs for vs-code will make it significantly harder for our devs to onboard. supporting the common case of |
Pinging the API issue here as well (#16994) |
That is correct. |
Could we please add an option to go back to the old "pythonPath" behaviour.
Selecting the python interpreter using the "python.pythonPath" setting has been working great for us. We check our Python environments into source control, along with the vscode settings and our code. Our engineers don't have to worry about anything; they just open the vscode workspace and everything works.
With this new "defaultPythonPath" system, a lot of our engineers are ending up with the wrong interpreter (it doesn't help that when this feature was rolled out, VSCode would prompt people to change the interpreter and then highlight a "recommended" interpreter which was the wrong one).
Once they have selected the wrong interpreter, they are then stuck with a broken VSCode. For most of our engineers, Python isn't their primary language, so they have no idea what's wrong. They will just suffer with broken Intellisense and spurious linting errors, and assume it's meant to be like that.
If I'm being honest, this new feature is a nightmare for us. We are desperate to go back to the old system where everything is centrally controlled and just works.
The text was updated successfully, but these errors were encountered: