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

VS Code Extension error - Unable to find any Python environment for the interpreter path: .venv/bin/python #568

Closed
abhat-koppert opened this issue Jul 30, 2024 · 3 comments

Comments

@abhat-koppert
Copy link

Hello,

It seems that the VS Code extension fails to work. Even with repeated restarts, the only messages I get it in the Output tab on VS Code are:

2024-07-30 11:11:01.601 [info] Using interpreter: .venv/bin/python
2024-07-30 11:11:01.612 [error] Unable to find any Python environment for the interpreter path: .venv/bin/python

I have uninstalled and reinstalled the extension. I have disabled and enabled it as well. Nothing works. I am attempting to run it on a Windows machine on WSL Ubuntu 22.04. I have also attempted to run it on a Dev Container in VS Code and am met with the same result. I make use of a virtual environment created using uv.

Let me know if there is any other information I can provide to make this easier to solve.

Relevant VS Code Settings

    "[python]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "charliermarsh.ruff"
    },
    "ruff.interpreter": [
        ".venv/bin/python"
    ],

Version information

ruff 0.5.5
charliermarsh.ruff v2024.36.0
VS Code v1.9.1
python 3.10.14
uv 0.2.31
@dhruvmanila
Copy link
Member

dhruvmanila commented Jul 30, 2024

Hey, sorry that you're facing this issue. Relative paths are not recommended in ruff.interpreter, it only worked earlier because there was an implicit fallback mechanism which was removed in e665ec7. For more information, refer to #553.

Assuming that this is relative to the current workspace folder, can you try the following?

    "ruff.interpreter": [
        "${workspaceFolder}/.venv/bin/python"
    ]

@abhat-koppert
Copy link
Author

Yes! Thanks a lot for the quick response. This seems to work just fine.

@abhat-koppert
Copy link
Author

Closing this issue. Thanks 👍🏼

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

2 participants