Skip to content
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

Selected python interpreter is not used in terminal window #14422

Closed
rchiodo opened this issue Oct 16, 2020 · 6 comments
Closed

Selected python interpreter is not used in terminal window #14422

rchiodo opened this issue Oct 16, 2020 · 6 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@rchiodo
Copy link

rchiodo commented Oct 16, 2020

I have two interpreters to use, both installed in global locations

image

I have the Python 3.9 one selected (as it also shows in the interpreter at the bottom left).

If I create a new terminal window, it uses the 3.8 one:

D:\Source\jupyter_server>python
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>          
@rchiodo rchiodo added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels Oct 16, 2020
@karthiknadig
Copy link
Member

Check your PATH variable. If the path to WindowsApps shows up first then the terminal will use that. This has nothing to do with python extension.

@rchiodo
Copy link
Author

rchiodo commented Oct 19, 2020

Isn't the interpreter picker supposed to force it to use that one?

@karthiknadig
Copy link
Member

No, we don't control this. These are globally installed python interpreters. which one is accessed purely depends on which one comes first in PATH.

If you have a activatable environment, and that environment was activated in the terminal. Then as a part of activation, usually the activation script (again not provided by the extension) will add the right path to the front of PATH. This is how most activations work. So, if you use python from an activated environment it will pick the right one.

@karthiknadig karthiknadig changed the title Python interpreter is not used in terminal window Selected python interpreter is not used in terminal window Oct 19, 2020
@rchiodo
Copy link
Author

rchiodo commented Oct 19, 2020

No, we don't control this.

Seems like a user may not understand this. What's the point of allowing me to pick the two interpreters then?

@karthiknadig
Copy link
Member

You are correct. People have filed bugs about this. The point of picking interpreters is to run the tools linter, formatter, debugger, intellisense, etc using the selected interpreter. The terminal represents how you have your system configured.

We do have a long term plan to solve this. It is not as straight forward as you would think. for example, pyenv using python shim, and figures out which version to run for each folder by looking at pyenv settings in that folder. People could have set an alias to python, so if we change what python means by changing just PATH that won't work. In short we have thought about this problem, and we plan on tackling it. But for now, the terminal works like how it is configured for your machine (i.e, selecting a python is VS Code, does not change your machine configuration.)

@karthiknadig
Copy link
Member

Duplicate of #4581
Related #13327

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Oct 19, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants