8000 v6.1.0 breaks fig.write_image() · Issue #5187 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

v6.1.0 breaks fig.write_image() #5187

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

Closed
petrchmelar opened this issue May 16, 2025 · 7 comments · Fixed by #5193
Closed

v6.1.0 breaks fig.write_image() #5187

petrchmelar opened this issue May 16, 2025 · 7 comments · Fixed by #5193
Assignees
Labels
bug something broken P1 needed for current cycle regression this used to work

Comments

@petrchmelar
Copy link
petrchmelar commented May 16, 2025

Hi, it seems that setting the ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS = False broke the write_image() method.

if ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS:
if (
kwargs.get("engine", None) in {None, "auto", "kaleido"}
and kaleido_available()
and kaleido_major() < 1
):
warnings.warn(KALEIDO_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
if kwargs.get("engine", None) == "orca":
warnings.warn(ORCA_DEPRECATION_MSG, DeprecationWarning, stacklevel=2)
if kwargs.get("engine", None):
warnings.warn(
ENGINE_PARAM_DEPRECATION_MSG, DeprecationWarning, stacklevel=2
)
return pio.write_image(self, *args, **kwargs)

https://github.com/plotly/plotly.py/pull/5177/files#diff-e30d1d28e90c51821f0eeed0db68656f4317c0754deaec93c3365b8a93b4caefR14

@petrchmelar petrchmelar changed the title V6.1.0 breaks fig.write_image() v6.1.0 breaks fig.write_image() May 16, 2025
@ErikPGJ
Copy link
ErikPGJ commented May 16, 2025

I see this problem too (it broke CI tests). I am not familiar with the source code but superficially, it works if one removes one level of indentation for return pio.write_image(self, *args, **kwargs).

@Remi-Gau
Copy link

regression test

import plotly.graph_objects as go
import numpy as np

def test_write_image(tmp_path):

    np.random.seed(1)

    N = 100
    x = np.random.rand(N)
    y = np.random.rand(N)

    fig = go.Figure()
    fig.add_trace(go.Scatter(
        x=x,
        y=y,
        mode="markers",
    ))

    fig.write_image(tmp_path / "fig1.png")

    assert (tmp_path /"fig1.png").exists()
E       AssertionError: assert False
E        +  where False = exists()
E        +    where exists = (PosixPath('/tmp/pytest-of-remi-gau/pytest-9/test_write_image0') / 'fig1.png').exists

Version tested

plotly kaleido test
6.0.1 0.2.1
6.1.0 0.2.1
6.1.0 1.0.0rc13

Also note that kaleido extra dependency

kaleido = ["kaleido==1.0.0rc13"]

will only work if the use ask for --prerelease.

Without this, pip install effectively falls back to 6.0.1.

$ pip install 'plotly[kaleido]' 

Resolved 3 packages in 6ms
Installed 3 packages in 291ms
 + narwhals==1.39.1
 + packaging==25.0
 + plotly==6.0.1
warning: The package `plotly==6.0.1` does not have an extra named `kaleido`
$ pip install --prerelease 'plotly[kaleido]'

Resolved 8 packages in 10ms
Installed 6 packages in 189ms
 + choreographer==1.0.7
 + kaleido==1.0.0rc13
 + logistro==1.1.0
 + orjson==3.10.18
 + plotly==6.1.0
 + simplejson==3.20.1

@zndr27
Copy link
zndr27 commented May 17, 2025

Same issue. When I call write_image with plotly 6.1.0 it silently fails to write an image (no error is raised). Reverting to plotly 6.0.1 resolves the issue.

I strongly suggest pulling 6.1.0 from PyPi because of the fact that this happens silently.

@gvwilson gvwilson added bug something broken P1 needed for current cycle regression this used to work labels May 20, 2025
@gvwilson
Copy link
Contributor

cc @emilykl @ayjayt

@emilykl
Copy link
Contributor
emilykl commented May 20, 2025

@petrchmelar @zndr27 This issue has been fixed and released in Plotly.py 6.1.1. Thank you for reporting.

@petrchmelar
Copy link
Author

Thanks a lot!

@zndr27
Copy link
zndr27 commented May 21, 2025

Thank you, great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P1 needed for current cycle regression this used to work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
0