apache / arrow

Apache Arrow is a multi-language toolbox for accelerated data interchange and in-memory processing
https://arrow.apache.org/
Apache License 2.0
14.1k stars 3.44k forks source link

[Python] Segmentation Fault when used with plotly.graph_objects #43037

Closed tafia closed 1 month ago

tafia commented 1 month ago

Describe the bug, including details regarding any error messages, version, and platform.

The following code produces a segmentation fault with

plotly==5.22.0
polars==0.20.31
pyarrow==16.1.0

Downgrading pyarrow to 15.0.0 (or using plotly.express) works.

from datetime import date, timedelta
import polars as pl
import plotly.graph_objects as go

df = pl.DataFrame(
    {
        "date": [date.today() + timedelta(i) for i in range(200)],
        "a": [float(i) ** 0.5 for i in range(200)],
    }
)

fig = go.Figure()
fig.add_trace(go.Scatter(x=df["date"], y=df["a"], name="a"))

Component(s)

Python

tafia commented 1 month ago

I understand that there are many libraries at play here but downgrading pyarrow to 15.0.0 seems to make it work so I suppose the root cause lies on pyarrow side.

tafia commented 1 month ago

Also opened an issue on polars side: https://github.com/pola-rs/polars/issues/17171

jorisvandenbossche commented 1 month ago

From reading the polars issue, is this a problem on their side with numpy 2.0?

I assume the reason this gets "fixed" by downgrading to pyarrow 15.0 is that this forces to install numpy < 2

tafia commented 1 month ago

Yes very likely. Sorry for the noise.