plotly / plotly/Kaleido

Apple Silicon crash when Kaleido is launched with `--disable-gpu` (macOS 15.4.1, M4 Max)

Open
#323 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Python
Stars
498
Forks
62
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Image generation fails on Apple Silicon when Kaleido is started with --disable-gpu (macOS 15.4.1, M4 Max)

Summary

Running the standalone Kaleido v0.2.1 binary on macOS 15.4.1 (Sequoia) with an Apple M4 Max fails to produce any image whenever the --disable-gpu flag is present (the default set that Plotly‑rs passes).
Kaleido returns error 525 ("error creating static canvas/context for image server") instead of the expected base64 payload.
Removing only that flag makes rendering work again.

Environment

item version / value
Kaleido binary 0.2.1 (wheel installed via pip install kaleido)
macOS 15.4.1 (23E214)
Chip Apple M4 Max (arm64)
Python 3.12.3
Rust (for the original call) 1.86.0
Calling app plotly‑rs 0.12 (plot.write_image)

Reproduction steps

  1. Save this Plotly spec to spec.json:

    {"format":"png","width":800,"height":600,"scale":1.0,"data":{"config":{},"data":[{"name":"Surface","type":"surface","x":[1.0,2.0,3.0],"y":[4.0,5.0,6.0],"z":[[1.0,2.0,3.0],[4.0,5.0,6.0],[7.0,8.0,9.0]]}],"layout":{}}}
    
  2. Run Kaleido with the default flag set (notice --disable-gpu):

  cat spec.json | ./kaleido plotly \
--disable-gpu \
--allow-file-access-from-files \
--disable-breakpad \
--disable-dev-shm-usage \
--disable-software-rasterizer \
--single-process \
--no-sandbox \
> out.b64

Output:

[WARNING:resource_bundle.cc(431)] locale_file_path.empty() for locale en-US
{"code": 0, "message": "Success", "result": null, "version": "0.2.1"}
{"code":525,"message":"error creating static canvas/context for image server","pdfBgColor":null,"format":"png","result":null,"width":800,"height":600,"scale":1}

No image data is returned (result is null).

  1. Run again, this time without --disable-gpu:
cat spec.json | ./kaleido plotly \
--allow-file-access-from-files \
--disable-breakpad \
--disable-dev-shm-usage \
--disable-software-rasterizer \
--single-process \
--no-sandbox \
> out.b64

jq -r '.result' out.b64 | base64 -d > out.png   # PNG decodes correctly

Kaleido exits cleanly:

{"code": 0, "message": "Success", "result": null, "version": "0.2.1"}

Expected behaviour

Kaleido should render the plot (or at least fail gracefully) even when --disable-gpu is passed, matching behaviour on Intel Macs and Linux builds.

Actual behaviour

  • With --disable-gpu: Kaleido returns code 525 and no image.
  • Without --disable-gpu: Kaleido returns the expected base64 PNG.

Notes & hypothesis

  • Apple Silicon’s ANGLE‑Metal backend initialises fine; disabling the GPU appears to remove both hardware and software rasterisers, so Chrome cannot create the canvas.
  • The flag combo is hard‑coded in plotly‑rs (plotly_kaleido/src/lib.rs). Removing it there is an effective workaround.
  • The universal2 wheel of kaleido 1.0.0‑rc11 (Chromium 120) does not reproduce the issue, but Plotly‑rs has not migrated yet.

Workarounds

# simple wrapper to strip the flag
#!/usr/bin/env bash
exec /path/to/kaleido "${@/--disable-gpu/}"

or build/run Kaleido without passing the flag on macOS‑arm64.


Happy to provide additional logs or test patches.

— Joaquín

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the flag construction in plotly_kaleido/src/lib.rs and reproduce the reported Kaleido 0.2.1 command on macOS arm64 using the provided spec.json. Compare rendering with and without --disable-gpu; done when the default flag set renders successfully or fails gracefully on Apple Silicon.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python, rust
Domain
computer-graphics, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.