question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Environment data

  • VS Code version: 1.57.0-insider commit 54d33cf14c
  • 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
stevetwistcommented, Jun 4, 2021

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

Thanks, Steve

0reactions
kimadelinecommented, Jun 8, 2021

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Interpreter Version not showing in status bar of VS ...
Here's how to pin it on the status bar now: Hover over the {} next to the Python language chooser; Click the pin...
Read more >
Python with Visual Studio Code on macOS - Medium
Select Python Environment in Status Bar. Select Python 3 Interpreter in the Command Palette. Selecting an interpreter sets the python.
Read more >
Debugging configurations for Python apps in Visual Studio Code
During debugging, the Status Bar shows the current configuration and the current debugging interpreter. Selecting the configuration brings up a list from ...
Read more >
PyCharm stopped to show interpreter in status bar : PY-50555
Even if I open Python Interpreter settings it will not list available interpreters. Attachments 2.
Read more >
Change Language & Region settings on Mac - Apple Support
If macOS or an app supports the primary language, that language is used. If not, the other languages are used, in the order...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found