-
Notifications
You must be signed in to change notification settings - Fork 120
Kaleido doesn't generate the image output on MacOS #241
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
Comments
@alceal thanks for reporting the issue. I was under the false impression that only the CI had issues. This means that indeed there is something wrong on MacOS. I will try to see if I can get to the bottom of it using the GitHub runners (don't own a Mac) . |
Just a heads up, we're working on a rebuild of Kaleido. The new versions are on PyPi as We released a few minors ( The timing of this ticket is about when we published the new versions, but as they're now yanked I wouldn't expect further issues. |
Hi Nathan, thank you for this info. I noticed that Greg commented on a few tickets on other projects related to Kaleido that a new version is coming out and I am looking forward to that. There is something broken in Kaleido or our integration with which causes this issue on plotly-rs, just didn't have the time to look into it. Will have to take the leap soon. We are using an older version though. Need to check if the newer release candidate improves things. FYI , in this crate, Kaleido gets downloaded at build time on the users machine and the package version is hardcoded here https://github.com/plotly/plotly.rs/blob/main/plotly_kaleido/build.rs |
Hi @alceal, is the architecture of your Mac by any chance |
@andrei-ng MacOS Sonoma 14.1.1 (23B81) |
Thank you @emilbratt! |
Been trying to track down the problem. It seems that is an Apple M1 Sillicon issue with Kaleido itslef. I asked a colleague to test it on his MacOS and he had no issues with Apple M3 Max . I am inclined to consider it to be a Kaleido issue as there have been some reports in the past related to that plotly/Kaleido#129 I will investigate further and provide another update once I know more. |
Yes, it's Apple Silicon M1 Max |
Thank you for confirming. |
Extra info – new failing test (Apple Silicon, macOS 15.4.1 / Rust 1.86.0)I’ve reproduced #241 on the latest Sequoia release. The minimal test below hangs and spits the familiar #[cfg(target_os = "macos")]
#[cfg(feature = "kaleido")]
#[test]
fn save_surface_to_png() {
use plotly::{ImageFormat, Plot, Surface};
use std::path::PathBuf;
let mut plot = Plot::new();
let surface = Surface::new(
vec![
vec![1.0, 2.0, 3.0],
vec![4.0, 5.0, 6.0],
vec![7.0, 8.0, 9.0],
])
.x(vec![1.0, 2.0, 3.0])
.y(vec![4.0, 5.0, 6.0])
.name("Surface");
plot.add_trace(surface);
let dst = PathBuf::from("out.png");
plot.write_image(dst.to_str().unwrap(), ImageFormat::PNG, 800, 600, 1.0);
// sanity checks
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
assert!(!plot.to_base64(ImageFormat::PNG, 1024, 680, 1.0).is_empty()); // Fail!
} Stderr (trimmed)
Environment
Happy to run more tests on Apple Silicon if that helps! —Joaquín |
Introduce macOS-specific arguments for Kaleido to address issue #323. Add new tests to validate image generation (e.g., PNG, JPEG, SVG, PDF) on macOS, ensuring proper functionality. This improves cross-platform support and resolves inconsistencies in the Kaleido backend. issue: plotly#241
Created Kaleido upstream issue: plotly/Kaleido#323 What happensOn Apple Silicon (tested on M4 Max / macOS 15.4.1),
because
Removing that single flag lets Kaleido 0.2.1 render the PNG just fine (see upstream issue for full logs). Quick workaround (no code changes)Create a tiny wrapper script called #!/usr/bin/env bash
DIR="$(cd "$(dirname "$0")" && pwd)"
# Strip the problematic flag
filtered=()
for arg in "$@"; do
[[ "$arg" == "--disable-gpu" ]] && continue
filtered+=("$arg")
done
exec "$DIR/bin/kaleido" "${filtered[@]}" After that, Longer‑term ideas
I created PR #289 to fix the issue until the new Kaleido release. — Joaquín |
* add macOS-specific fixes and tests for Kaleido compatibility Introduce macOS-specific arguments for Kaleido to address issue #323. Add new tests to validate image generation (e.g., PNG, JPEG, SVG, PDF) on macOS, ensuring proper functionality. This improves cross-platform support and resolves inconsistencies in the Kaleido backend. * Add macOS-specific test surface creation and adjust imports Introduced a macOS-specific `create_test_surface` function in `plotly_kaleido` and adjusted test-related imports in `plotly`. Ensures compatibility with macOS while keeping non-macOS logic intact. * Refactor imports in plot.rs tests for macOS compatibility issue: #241
I'm using the example from the README.md to test the
write_image
function, but it neither generates nor panics. I'm on MacOS 15.0.1 (Sequoia).The text was updated successfully, but these errors were encountered: