plotly / Kaleido

Fast static image export for web-based visualization libraries with zero dependencies
Other
348 stars 33 forks source link

Static image export hangs using kaleido: all the ways have been tried #145

Open whaleprince opened 1 year ago

whaleprince commented 1 year ago

I want to get the static image using write_image method, but the program hangs. I have tried severvel method: 1) pio.kaleido.scope.mathjax = None 2) use kaleido 0.1.0 , 0.2.0, 0.0.3 version but all of them don’t help.

my setup are: os:Linux plotly: 5.10.0 kaleido: 0.2.1

the same code in windows runs normally.

test code:

import plotly.express as px
import numpy as np

img_rgb = np.array([[[255, 0, 0], [0, 255, 0], [0, 0, 255]],], dtype=np.uint8)

fig = px.imshow(img_rgb)
fig.write_image("fig.png", engine="kaleido")

are there someone know why?

miohtama commented 7 months ago

We located a hang in Kaleido when drawing static Plotly charts using Kaleido backend.

Kaleido launches a Chromium in a subprocess and then communicates with this subprocess to generate the image. If there is a problem in the subprocess communication (subprocess does not respond, hangs, dies) Kaleido may wait forever.

Releated issue

https://github.com/tradingstrategy-ai/trade-executor/issues/699#issuecomment-1835856088