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

Cannot find ruff on Windows in venv using --system-site-packages #13110

Open
markuspi opened this issue Aug 26, 2024 · 1 comment
Open

Cannot find ruff on Windows in venv using --system-site-packages #13110

markuspi opened this issue Aug 26, 2024 · 1 comment
Labels
windows Specific to the Windows platform

Comments

@markuspi
Copy link

markuspi commented Aug 26, 2024

python -m ruff can't find ruff.exe on Windows when using a virtual environment generated using --system-site-packages:

  1. Prerequisite: have ruff installed system-wide on Windows. The bug does not trigger if it is installed in the per-user packages in AppData.
    Example: I have a Python311 installed in C:\Python311, with ruff at C:\Python311\Lib\site-packages\ruff\__main__.py and C:\Python311\Scripts\ruff.exe.

  2. Create virtual environment using --system-site-packages flag

    C:\Python311\python -m venv --system-site-packages myvenv
  3. Using virtual environment to run python -m ruff results in FileNotFoundError.

    .\myvenv\Scripts\python -m ruff
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "C:\Python311\Lib\site-packages\ruff\__main__.py", line 40, in <module>
        ruff = os.fsdecode(find_ruff_bin())
                           ^^^^^^^^^^^^^^^
      File "C:\Python311\Lib\site-packages\ruff\__main__.py", line 36, in find_ruff_bin
        raise FileNotFoundError(scripts_path)
    FileNotFoundError: C:\[...]\myvenv\Scripts\ruff.exe
    

Ruff version: 0.6.2

@dhruvmanila dhruvmanila added the windows Specific to the Windows platform label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Specific to the Windows platform
Projects
None yet
Development

No branches or pull requests

4 participants
@markuspi @dhruvmanila and others