Skip to content

Interpreter shown in the status bar is not the selected one on MacOS #16197

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

Closed
kimadeline opened this issue May 10, 2021 · 11 comments · Fixed by #16391
Closed

Interpreter shown in the status bar is not the selected one on MacOS #16197

kimadeline opened this issue May 10, 2021 · 11 comments · Fixed by #16391
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority info-needed Issue requires more information from poster regression Bug didn't exist in a previous release

Comments

@kimadeline
Copy link

Environment data

  • VS Code version: 1.57.0-insider commit 54d33cf
  • Extension version (available under the Extensions sidebar): 2021.5.821509413-rc
  • OS and version: macOS Big Sur 11.2.3
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.0a5 (global), 3.6.9 venv
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Pylance

Expected behaviour

Interpreter shown in the status bar should be the selected interpreter.

Actual behaviour

Interpreter shown is whatever the extension could find (it's not even the interpreter I use in python.defaultInterpreterPath and I opted into all experiments), in this case /usr/local/bin/python3.

Notes:

  • Opening a new terminal will activate the correct interpreter.
  • Selecting a different interpreter in the quickpick will update the status bar to the correct one.
  • Opening another Python file will also update the status bar.

Note the difference between the interpreter in the bottom left, and the current interpreter in the quickpick:

Screen Shot 2021-05-10 at 11 48 11 AM

Steps to reproduce:

  1. Open a Python project, install the extension, reload the window and wait for the extension to activate
  2. Notice that the interpreter shown in the status bar is not the one selected for the project

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'All'
Python interpreter path: /usr/local/bin/python3
Error 2021-05-10 12:03:52: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/hello-pipenv-two-dcBnVr68 doesn't contain a valid path to the project
Error 2021-05-10 12:03:52: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/pipenv-two-KgBt83I1 doesn't contain a valid path to the project
Error 2021-05-10 12:03:53: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/pipfile_hello_world-9fihYaKL doesn't contain a valid path to the project
Error 2021-05-10 12:03:53: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/pytest-libfaketime-ChaRi4Fc doesn't contain a valid path to the project
Error 2021-05-10 12:03:53: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/upper_level_project-hGd-hSjF doesn't contain a valid path to the project
Error 2021-05-10 12:03:53: The .project file inside environment folder: /Users/kimiguel/.local/share/virtualenvs/vscode_multi_workspace_bug_repro-mhhNtleX doesn't contain a valid path to the project
Starting Jedi language server.
Error 2021-05-10 12:03:53: Failed to check if file needs to be fixed EntryNotFound (FileSystemError): Unable to read file '/Users/kimiguel/Documents/Sandbox/simple-bot/.vscode/settings.json' (Error: Unable to resolve non-existing file '/Users/kimiguel/Documents/Sandbox/simple-bot/.vscode/settings.json')
    at _handleError (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87:156604)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at y.readText (/Users/kimiguel/.vscode-insiders/extensions/ms-python.python-2021.5.821509413-rc/out/client/extension.js:9:344717)
    at p.doesFileNeedToBeFixed (/Users/kimiguel/.vscode-insiders/extensions/ms-python.python-2021.5.821509413-rc/out/client/extension.js:59:581560)
    at /Users/kimiguel/.vscode-insiders/extensions/ms-python.python-2021.5.821509413-rc/out/client/extension.js:59:580687
    at async Promise.all (index 1)
    at p.getFilesToBeFixed (/Users/kimiguel/.vscode-insiders/extensions/ms-python.python-2021.5.821509413-rc/out/client/extension.js:59:580633)
    at p.updateTestSettings (/Users/kimiguel/.vscode-insiders/extensions/ms-python.python-2021.5.821509413-rc/out/client/extension.js:59:580260) {
  code: 'FileNotFound'
}
Python interpreter path: ./.venv37/bin/python

@kimadeline kimadeline added bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team labels May 10, 2021
@kimadeline kimadeline changed the title Intepreter shown in the status bar is not the selected one Interpreter shown in the status bar is not the selected one May 10, 2021
@kimadeline
Copy link
Author

Need to investigate to see if it's a mac-only issue.

@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments needs PR important Issue identified as high-priority and removed triage-needed Needs assignment to the proper sub-team labels May 11, 2021
@stevetwist
Copy link

Not sure if this is helpful, or what additional information I can provide, but I am experiencing this exact behavior on Windows 10.

When I first open a workspace the interpreter shown is a random interpreter VSCode found (it's not set for any of my workspaces). Opening another file then updates to display the correct interpreter, set for my workspace. From that point on (in the session) everything is fine.

Thanks,
Steve

@kimadeline
Copy link
Author

Yep it is! Thanks for confirming that it doesn't happen only on macs @stevetwist!

@kimadeline
Copy link
Author

Introduced by #15971

@kimadeline kimadeline assigned karrtikr and unassigned kimadeline May 27, 2021
@karrtikr
Copy link

karrtikr commented May 27, 2021

Could be related: #16291. Can anyone confirm if this only happens when in DeprecatePythonPath experiment? i.e does #16291 (comment) help?

@kimadeline
Copy link
Author

Happens when not in the DeprecatePythonPath experiment:

User belongs to experiment group 'pythonDiscoveryModule'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'

@karrtikr
Copy link

karrtikr commented Jun 3, 2021

@stevetwist Unfortunately I'm unable to reproduce this on Windows when not in deprecate python path exp. Can you try #16291 (comment) and see if it helps?

@stevetwist
Copy link

@karrtikr I can confirm that opting out of the 'DeprecatePythonPath' experiment fixed this issue for me, on Windows.

Thanks,
Steve

@karrtikr karrtikr changed the title Interpreter shown in the status bar is not the selected one Interpreter shown in the status bar is not the selected one on MacOS Jun 4, 2021
@karrtikr
Copy link

karrtikr commented Jun 4, 2021

@kimadeline It seems this issue is only on Mac then so I cannot reproduce this. #16391 has just been merged which could potentially fix it, can you check if you can repro this on main?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jun 4, 2021
@karrtikr
Copy link

karrtikr commented Jun 4, 2021

Happens when not in the DeprecatePythonPath experiment:

I'm observe that for some reason we no longer log if the user is in DeprecatePythonPath - experiment, maybe it's a bug with the old framework. So we can't rely on logs to figure out which experiments user is in.

@kimadeline
Copy link
Author

I can't reproduce it using Insiders version 2021.6.916495917-dev 🥳

Since this is fixed in Insiders @stevetwist you can either set up the Python extension to use one of our Insiders release channel with the python.insidersChannel setting (either weekly or daily should work), or you can wait for the next stable release of the Python extension later this month, which will include this fix.

Thank you!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority info-needed Issue requires more information from poster regression Bug didn't exist in a previous release
Projects
None yet
5 participants