Skip to content

Ruff VSCode extension does not work on NixOS #563

Open
@samuela

Description

@samuela

I just installed the Ruff VSCode extension v2024.16.0. However, I'm seeing the following error in Output > Ruff:

2024-04-03 22:32:28.078 [info] Interpreter executable (/nix/store/qzaa6lxhvlbb9nn2v6ssppmqg4c3pb1p-python3-3.11.8/bin/ruff) not found
2024-04-03 22:32:28.078 [info] [Trace - 10:32:28 PM] Received notification 'window/logMessage'.
2024-04-03 22:32:28.078 [info] Falling back to bundled executable: /home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/bin/ruff
2024-04-03 22:32:28.081 [info] 2024-04-03 22:32:28,079 ERROR Exception occurred for message "15": FileNotFoundError: [Errno 2] No such file or directory: '/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/bin/ruff'
Traceback (most recent call last):
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/pygls/protocol/json_rpc.py", line 194, in _execute_request_callback
    self._send_response(msg_id, result=future.result())
                                       ^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/server.py", line 1220, in format_document
    return await _format_document_impl(params, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/server.py", line 1260, in _format_document_impl
    result = await _run_format_on_document(document, settings, range)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/server.py", line 1912, in _run_format_on_document
    executable = _find_ruff_binary(settings, version_requirement)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/server.py", line 1750, in _find_ruff_binary
    version = _executable_version(path)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/server.py", line 1825, in _executable_version
    version = utils.version(executable)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/ruff_lsp/utils.py", line 96, in version
    output = subprocess.check_output([executable, "--version"]).decode().strip()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qzaa6lxhvlbb9nn2v6ssppmqg4c3pb1p-python3-3.11.8/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qzaa6lxhvlbb9nn2v6ssppmqg4c3pb1p-python3-3.11.8/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/qzaa6lxhvlbb9nn2v6ssppmqg4c3pb1p-python3-3.11.8/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/qzaa6lxhvlbb9nn2v6ssppmqg4c3pb1p-python3-3.11.8/lib/python3.11/subprocess.py", line 1953, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/bin/ruff'

2024-04-03 22:32:28.082 [info] [Trace - 10:32:28 PM] Received response 'textDocument/formatting - (15)' in 6ms. Request failed: FileNotFoundError: [Errno 2] No such file or directory: '/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/bin/ruff' (-32603).
2024-04-03 22:32:28.082 [info] [Error - 10:32:28 PM] Request textDocument/formatting failed.
2024-04-03 22:32:28.082 [info]   Message: FileNotFoundError: [Errno 2] No such file or directory: '/home/skainswo/.vscode-server/extensions/charliermarsh.ruff-2024.16.0-linux-arm64/bundled/libs/bin/ruff'
  Code: -32603 
[object Object]

Perhaps this is due to a dynamic linking issue on NixOS?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions