astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On M1, charliermarsh.ruff-2023.54.0 is failing with OSError: [Errno 86] Bad CPU type in executable

cpbotha opened this issue · comments

It looks like the x86_64 build of ruff is accidentally bundled with the arm64 package.

The full error from the extension host log is:

2023-12-14 22:09:28.445 [error] [charliermarsh.ruff] provider FAILED
2023-12-14 22:09:28.445 [error] Error: OSError: [Errno 86] Bad CPU type in executable: '/Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/bundled/libs/bin/ruff'
    at /Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/dist/webpack:/ruff/node_modules/vscode-jsonrpc/lib/common/connection.js:567:57
    at message (/Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/dist/webpack:/ruff/node_modules/vscode-jsonrpc/lib/common/connection.js:662:26)
    at isDisposed (/Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/dist/webpack:/ruff/node_modules/vscode-jsonrpc/lib/common/connection.js:338:42)
    at Immediate.<anonymous> (/Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/dist/webpack:/ruff/node_modules/vscode-jsonrpc/lib/common/connection.js:409:13)
    at processImmediate (node:internal/timers:476:21

Indeed, file confirms that the binary is x86_64 and not arm64:

$ file /Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/bundled/libs/bin/ruff
/Users/charlbotha/.vscode/extensions/charliermarsh.ruff-2023.54.0-darwin-arm64/bundled/libs/bin/ruff: Mach-O 64-bit executable x86_64

This was also mentioned in a recent comment on another recent issue:
#362 (comment)

I was able to work around this by installing an arm64 build of ruff 0.1.8 using homebrew, and then pointing the vscode extension to it at /opt/homebrew/bin/ruff via the ruff.path user setting.

Huh, what, how on Earth...? We didn't change anything in the build pipeline. I'll look into it, thanks a ton for filing this.

Okay, something changed such that both the X86 and ARM Darwin builds went from using the Universal to the X86 wheel. Will fix this shortly... In the meantime, you can install Ruff with pip and the extension should defer to that version.

Should be fixed in the latest release (2023.56.0, publishing now).