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

Can't debug; fails to read interpreter info from storage. Always "You need to select a Python interpreter..." #206293

Open
mnmkay opened this issue Feb 4, 2024 · 5 comments
Assignees

Comments

@mnmkay
Copy link

mnmkay commented Feb 4, 2024

extensions:
Python v2024.0.0
Python Debugger v2024.0.0
(also isort v2023.10.1, Pylance v2023.12.1. never manually installed conda and the exe in not in PATH)
I've tried removing all ms-python.* folders in vscode extensions directory and reinstalled.

The issue and test case are as follows:
I create a new empty folder.
I place 1 empty .py file in it.
I open this folder as a workspace using File->Open Folder.
*** In the VSCode user data (workspaceStorage) folder this now creates a new subfolder with state.vscdb etc.

At this point I am able to run the python debugger on the empty .py file, with or without launch configuration. Never asked to select interpreter. I have 3 versions installed which it finds, 2 of which are >= 3.7. (as well dead location(s) of no-longer-installed versions that it tries to find with ENOENT error, according to Output/Python console). If I select either 3.7+ version manually (Python: Select Interpeter), either loads no problem; debugger command line run in PowerShell is: ".. <.../ms-python-debugpy-2024.0.0-win32-x64/..." etc. Extension seems to work fine.

The problem:
I now close the folder with File->Close Folder. I reopen the folder.
*** The workspaceStorage/state.vscdb now have pre-existed

I can no longer run the debugger. Any attempting to do so fails with dialog telling me "You need to select a Python interpreter...". I select one, but then always fails without running any shell, with dialog "Debug stopped." Even though the interpreter was selected in previous step or I select it again manually otherwise, it always asks again at the next attempt. It fails to read/store the selection.

However note that now, at any time, if I create a launch.json with the provided template then change the configuration type from "debugpy" back to "python", it will work with the version I have selected. PowerShell command is: ".. <.../ms-python-python-2024.0.0..."

@mnmkay
Copy link
Author

mnmkay commented Feb 24, 2024

Luckily I've tracked it down to this unrelated setting. I remove it before VSCode starts and the problem goes away and I can debug now. I have Microsoft C/C++ extension installed.

	"extensions.experimental.affinity": {
		"ms-vscode.cpptools": 2
	},

I'm having another random inexplicable problem that I hope also goes away by this. Looks like experimental affinity is indeed an invitation for strange problems.

@mmaeusezahl
Copy link

I'm also affected by this problem. With default settings and otherwise new workspace I'm always running into "You need to select a Python interpreter...".

I'm working on Manjaro and have tried both the stable and pre-release versions of the Python extension. For me the aforementioned solutions didn't work alone. What somewhat worked for me was to:

  • manually clear the workspace storage for the affected workspace by removing the respective folder in $HOME/.config/Code/User/workspaceStorage/
  • using "python" instead of "debugpy" in the launch.conf

Doing only one of both things is not sufficient. I have no other extensions installed.

I also noticed that the issue doesn't appear when installing the Python extension during a VSCode session.

Would be happy to supply more info if helpful since this problem is really breaking for me.

@mmaeusezahl
Copy link

After writing the previous comment I tried something else:

After restarting vscode everything now works as expected (even with debugpy).
I know that the newest version of vscode (1.86.2) was pulled in through a system update yesterday (when the issue started) so I presume that it was the origin of the issues and the configuration that was carried over from the previous version did not play as intended with the new version...

@paulacamargo25
Copy link
Contributor

Thanks @mmaeusezahl it looks like an issue in vscode, ill transfer the issue to them.

@paulacamargo25 paulacamargo25 transferred this issue from microsoft/vscode-python-debugger Feb 26, 2024
@Imanuel-Miz
Copy link

@mmaeusezahl , I had the same issue, turns out you don't need to completely remove the $HOME/.config/Code/ folder.
Inside this folder, there is a settings.json file, I found inside some "experimental" settings, after removing them, and restart vscode - issue solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants