plotly / Kaleido

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

Kaleido takes over 1 hour to fail to export Scattergeo #143

Closed leculette closed 2 months ago

leculette commented 2 years ago

I've created a figure with 3 subplots. One of them being a scattergeo.

fig = make_subplots(rows=3, cols=1, horizontal_spacing=0, vertical_spacing=0.0,
        specs=[[{"type": "scattergeo"}], [{"type":"table"}], [{"type": "polar"}]])

The above worked seamlessly on my local machine when running tests. But it broke on my EC2 instance, 4.14.256-197.484.amzn2.aarch64.

whenever I terminate execution I see it stalls at response = self._proc.stdout.readline()

plotly==5.5.0 kaleido==0.2.1

After a lot of trial and error I was able to detect why my figure was stalling when exporting. It seems that it it is Scattergeo the issue

This code breaks when testing on the EC2 isntance

import plotly.io as pio
import plotly.graph_objects as go

fig = go.Figure(
    data=[go.Scattergeo(lat=[1, 2, 3], lon=[1, 3, 2])],
    layout=go.Layout(
        title=go.layout.Title(text="A Figure Specified By A Graph Object")
    )
)

fig.to_image(format="png", engine="kaleido") 

I've tried to set mathjax to None, going back to kaleido==0.1.0 but nothing avoids the amazing delay. It is not even working. After 1 hour it just throws a Memory Error.

Luckily for me I found out that the code below works

fig = go.Figure(
    data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])],
    layout=go.Layout(
        title=go.layout.Title(text="A Figure Specified By A Graph Object")
    )
)

fig.to_image(format="png", engine="kaleido") 

I am hopeless to make the desired plot. Since I am not relying 100% on the scattergeo I could drop it. But it would be amazing to keep it.

Thanks in advance.

mysteriousHerb commented 2 years ago

try pip install --upgrade "kaleido==0.1.0post1"

there is a clear bug with latest kaleido somehow

gvwilson commented 2 months ago

Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson