-
Notifications
You must be signed in to change notification settings - Fork 53
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
Misconfigured Python interpreter leads to Ruff extension not loading #619
Comments
Thanks for opening a new issue. Looking into it. I believe the extension gets as far as ruff-vscode/src/common/server.ts Lines 425 to 441 in 69a99f6
I suspect it fails somewhere before ruff-vscode/src/common/server.ts Lines 394 to 413 in 69a99f6
Just wondering because we had something similar in the past. Is there a message pop up showing up? If so, could you try dismissing it? If not, could you try setting |
There is no message popping up related to Ruff. I tried setting |
I don't know what the problem is but I noticed that we aren't correctly logging errors if the extension fails to handle some request. I'll put up a PR improving logging and that should hopefully help us to narrow this down. Sorry that you're running into this. |
Maybe we can get the logs sooner. Do you see any error messages in the It should look like this (I intentionally introduced a bug to demonstrate this):
|
OK I believe I have found and fixed the root cause by observing the 2024-09-20 15:56:08.862 [error] Error: Failed to resolve env "/home/csk/src/org/an-org/a-project/.venv-dev/bin/python"
at ae (/home/csk/.vscode-server-insiders/extensions/ms-python.python-2024.14.1-linux-x64/out/client/extension.js:2:2041224)
at oe (/home/csk/.vscode-server-insiders/extensions/ms-python.python-2024.14.1-linux-x64/out/client/extension.js:2:2039184)
at Immediate.<anonymous> (/home/csk/.vscode-server-insiders/extensions/ms-python.python-2024.14.1-linux-x64/out/client/extension.js:2:2035478)
at processImmediate (node:internal/timers:478:21) After removing the problematic projects from VS Code the Ruff extension started working correctly again. Adding these problematic projects back into VS Code causes the Ruff extension to stop working once again. Perhaps this could be a useful test case. For me the problem is resolved. I'll leave it up to you to either close this now, or keep it open to address the underlying issue if that makes sense. It's worth noting that other VS Code python extensions such as Mypy do continue to function correctly in the presence of these misconfigured python envs, so it feels like an issue with the Ruff extension, though I'm not knowledgable enough to make that determination. Thanks for all your help @MichaReiser. I was surviving with my ruff pre-commit hooks but having the extension working again is great. |
Thanks. That's helpful. Yeah I think we can improve the handling of errors or being more resilient against misconfigured interpreters. I'll mark this as an improvement. |
I am also seeing the stuck spinner. With the following error message in the Extension host Output:
|
Related: #598 |
In case it helps in debugging at all, after some fiddling, it seems setting |
@lsouder-ozone3d I'm not sure that the logs that you've provided are from Ruff. You've mentioned "Extension host" but that's not related to Ruff. Can you open a new issue with the logs from Ruff? Refer to the troubleshooting guide. |
I'm going to merge this into #598 |
@lsouder-ozone3d Ok, I think it might be related to |
@dhruvmanila The setting mentioned in the comment above is the only setting I have set for Ruff. Previously, I was running with all defaults. |
@lsouder-ozone3d do you still face the same problem? Can you open a new issue with some details to help us debug? |
Recently Ruff stopped performing any code actions for my python files and the extension state icon remains spinning indefinitely (see screenshot below). This issue is similar to #609 in appearance in the VS Code UI, but different in that there appears to be no communication with the ruff server.
This started happening a couple of weeks ago without any changes to my vs code settings. I'm on auto update, so I guess an update caused this. I've tried with
ruff.nativeServer
set toon
,off
, andauto
. This is all I get in the ruff logs (verbose logging enabled). Seeing this with all my environments. I've tried uninstalling the extension and reinstalling.User VS Code settings file Ruff config
Project VS Code settings file (
.vscode/settings.json
)Pyproject Ruff settings (
pyproject.toml
)My env:
This problem is not limited to pyenv virtualenvs. I'm having the same issue with all VS Code projects some of which use virtualenvs created with the system python using
python -m venv .venv
etc.The text was updated successfully, but these errors were encountered: