Skip to content

Conversation

@stefanv
Copy link
Member

@stefanv stefanv commented Dec 5, 2024

No description provided.

@stefanv stefanv added the 🔧 type: Maintenance Refactoring and maintenance of internals label Dec 5, 2024
@stefanv
Copy link
Member Author

stefanv commented Dec 6, 2024

Waiting on plotly/plotly.py#4926

@stefanv
Copy link
Member Author

stefanv commented Jan 24, 2025

No new release forthcoming so far :(

@stefanv stefanv force-pushed the kaleido-1.0.0 branch 2 times, most recently from 230f10c to 1bb887f Compare January 28, 2025 19:57
@stefanv
Copy link
Member Author

stefanv commented Feb 3, 2025

xref: plotly/Kaleido#242

@ayjayt
Copy link

ayjayt commented Feb 24, 2025

Hi thread! @stefanv

There are new pre-releases slated on github of kaleido: https://github.com/plotly/Kaleido/tree/latest-tag

Once Kaleido >= v1.0.0rc1 is integrated into plotly.py (for figure.write_figure(PATH) shortcut API), it will be released as v1.0.0 official.

But the base Kaleido API is stable and can also be used like this:

import kaleido
kaleido.write_fig_sync(some_figure, path="./output./")

Here are some more examples:
https://github.com/plotly/Kaleido/blob/master/src/py/docs/examples.md
The new API enables multi-processor and more memory efficient processing, which may be of interest for this project.

The new kaleido release requires a chromium-ish browser (chromium, chrome, edge) to be installed and accesible.
This is also possible from a CLI that comes with kaleido:

kaleido_get_chrome --help

That command also uses tested chromiums in case new versions introduce bugs (they do sometimes).

Feel free to @ me for any help.

@stefanv
Copy link
Member Author

stefanv commented Feb 26, 2025

Thansk @ayjayt! Are you planning to make a new RC release on PyPI so we can try it?

@ayjayt
Copy link

ayjayt commented Feb 26, 2025

If I convince the rest of the team the documentation that I wrote is sufficient for a rc I think we can push the next rc to pypi, I can bring it up tomorrow.

The rc will get bumped to a full release once plotly.py finishes integration and the technical writer approves, I imagine.

There is also a branch on github called latest-tag which follows the latest release (pre or full), so any eager users can install with:

pip install git+https://github.com/plotly/kaleido@latest-tag#subdirectory=src/py

@stefanv
Copy link
Member Author

stefanv commented Feb 26, 2025

Testing directly from gh is a bit finicky with our CI, but the last two commits here should take care of it.

@stefanv
Copy link
Member Author

stefanv commented Feb 26, 2025

@ayjayt Doesn't look like the plotly backend is picking up on kaleido rc6? It still talks about installing orca:

ImportError: orca and psutil are required to use the `sphinx-gallery-orca` renderer. See https://plotly.com/python/static-image-export/ for instructions on how to install orca. Alternatively, you can use the `sphinx-gallery` renderer (note that png thumbnails can only be generated with the `sphinx-gallery-orca` renderer).

See the failed "Test docs" CI entry above.

@ayjayt
Copy link

ayjayt commented Feb 27, 2025

Yes exactly, that's what I've failed to articulate.

The kaleido api is stable in kaleido>=v1.0.0rc1 as such:

import kaleido
kaleido.write_fig_sync(fig, path)

But until the plotly integration is done, this won't work:

import plotly
fig = ...
fig.write_image(path)

Once the plotly.py integration is finished and this shortcut function is back, v1.0.0 will be released.

@ayjayt
Copy link

ayjayt commented Feb 27, 2025

@stefanv, the kaleido api (not the plotly.Figure.write_image() shortcut) will be much faster and more memory efficient for batch processing and I imagine it will be a better choice for this project, but I'm assuming there are quite a few images here.

@ayjayt
Copy link

ayjayt commented Feb 27, 2025

My personal goal in this exercise was to reasonably enable making movies from plotly figures.

Plotly animations work for simple graphs, but the new kaleido allows to output 100's of frames (without OOM killer, and in a reasonable timeframe) and string them into an MP4, create data movies:

324344285-dc13af46-5e78-4c4d-a03c-94d6cc40e554.mp4

@stefanv
Copy link
Member Author

stefanv commented Feb 27, 2025

That's awesome :)

My goal is just to get the skimage docs to build again, without pinning an ancient version of kaleido, which is not currently possible :(

@ayjayt
Copy link

ayjayt commented Feb 27, 2025

@stefanv I can probably fix the PR, give me a day, I should be able to do it in <15 minutes with a grep

@stefanv
Copy link
Member Author

stefanv commented Feb 27, 2025

Well, I think we don't want to use unintuitive or non-standard API in our examples, so we may need to wait for the plotly integration, or figure out a backend hack.

@ayjayt
Copy link

ayjayt commented Feb 27, 2025

I'll keep you posted

@stefanv
Copy link
Member Author

stefanv commented Feb 27, 2025

Thanks!

@stefanv
Copy link
Member Author

stefanv commented Mar 7, 2025

@ayjayt Any update on the kaleido / plotly integration and release?

@ayjayt
Copy link

ayjayt commented Mar 11, 2025

Hi @stefanv, there is plotly/plotly.py#5062 which is slated for 6.1.0 AFAIK (this month)

I will be pushing forward on some of their tasks today, let me know if there is anything I can do for you in the meantime.

@stefanv
Copy link
Member Author

stefanv commented Mar 17, 2025

No go with latest plotly.

@stefanv
Copy link
Member Author

stefanv commented Apr 21, 2025

@ayjayt Are you still interested in this problem? The current failure is:

        AttributeError: module 'kaleido' has no attribute 'calc_fig_sync'

@ayjayt
Copy link

ayjayt commented Apr 21, 2025

Yes this is still in progress! Some newer releases are out and official releases are just making their way through the pipeline. It's mainly fixing up documentation and integrating with Plotly! I'll give a more thorough review of issues this evening.

@ayjayt
Copy link

ayjayt commented May 22, 2025

I wouldn't install with the package manager, I would install with our CLI tool since its the last known good version.

If I have access I can debug this tomorrow, I'm working on this stuff at a pycon sprint.

@ayjayt
Copy link

ayjayt commented May 28, 2025

Alright, I'm in this now.

I have to:

  • Modify workflow files for consistency (slim builds can be tough)
  • Enable verbose logging in GHA
  • Capture un-serializable object and either add encoder or switch serializer

Here's where my work will be: #7803

(some of this stuff is platform dependent, so I need to dump stuff in the CI, some of this stuff is not, so I can work on it locally if I can reproduce it)

@stefanv
Copy link
Member Author

stefanv commented May 28, 2025

Thanks, @ayjayt, appreciated. Currently, the error messages in CI hide much of the specifics of what's going wrong. It'd be good to expose at least some of that by default.

@ayjayt
Copy link

ayjayt commented May 28, 2025

im going to add an environmental variable or check for one that circle ci/gha set. Chromium is very noisy!

We use pytest, which captures all logging output and dumps it if theres is an error. It would be nice if all CI tools did that.

@stefanv stefanv marked this pull request as ready for review July 16, 2025 09:07
@stefanv
Copy link
Member Author

stefanv commented Nov 4, 2025

choreographer.browsers._errors.BrowserFailedError: ('The browser seemed to close immediately after starting.', 'You can set the logging.Logger level lower to see more output.', 'You may try installing a known working copy of Chrome by running ', '$ choreo_get_chrome. It may be your copy auto-updated.')

I don't really like that it seems to be so picky about the Chrome version required.

@ayjayt
Copy link

ayjayt commented Nov 26, 2025

choreographer.browsers._errors.BrowserFailedError: ('The browser seemed to close immediately after starting.', 'You can set the logging.Logger level lower to see more output.', 'You may try installing a known working copy of Chrome by running ', '$ choreo_get_chrome. It may be your copy auto-updated.')

I don't really like that it seems to be so picky about the Chrome version required.

Neither am I.

Plotly used to build and ship a chrome engine inside kaleido but that become infeasible when the binary got too big to host on package distributors.

I am building testing and a possible long term solution for this but it's sort of intractable, given browsers are our #1 interactive rendering engines and nobody ships a browser architected to use it in parts.

That said, I don't think linux-arm has a significant user base for the package. I'm not sure what you're seeing, but we don't get ANY issues for it outside of this one. And I would assume Google feels the same way, or else they would be offering a version of it for testing.

I could be wrong though, and I am still eyeing ways to solve it.

@stefanv
Copy link
Member Author

stefanv commented Dec 9, 2025

Maybe could try and debug the issue on a Raspberry Pi? I'd recommend adding an M.2 NVME hat, it really helps with disk access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 type: Maintenance Refactoring and maintenance of internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants