Skip to content

setDaemon() Deprecation warning for to_image #194

Closed

Description

@huonw

If one executes to_image with Python 3.10 or greater, there is deprecation warning about setDaemon:

from plotly.graph_objs import Figure
Figure().to_image()
.../.venv/lib/python3.10/site-packages/kaleido/scopes/base.py:188: DeprecationWarning:

setDaemon() is deprecated, set the daemon attribute instead

This appears when warnings are enabled, such as python -W default ... or running tests under pytest.

All-in-one reproducer:

# do it all in a temporary directory/venv
cd $(mktemp -d)
python3.10 -m venv .venv

# install all dependencies
.venv/bin/python -m pip install kaleido==0.2.1 plotly==5.21.0 tenacity==8.2.3 packaging==24.0

# BUG: run to_image, with warnings enabled:
.venv/bin/python -W default -c 'from plotly.graph_objs import Figure; Figure().to_image()'
# DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead

Based on #171, this can probably be resolved by doing a new release of Kaleido to PyPI & conda, since #146 appears to fix it in the unreleased code on the master branch.

Alternatively, if Kaleido is unmaintained (and thus may stop working with future Python versions), maybe Plotly.py needs to support another engine?

Thanks for Plotly!

Activity

  1. transferred this issue fromplotly/plotly.pyon Jul 11, 2024
  2. gvwilson commented on Jul 26, 2024

    @gvwilson
    Contributor

    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

  3. self-assigned this
    on Jul 26, 2024
  4. removed their assignment
    on Aug 3, 2024
  5. thijssnelleman commented on Oct 28, 2024

    @thijssnelleman

    Any update on this issue?

  6. jkittner commented on Nov 12, 2024

    @jkittner

    This seems to be a duplicate of #171 and was resolved by #146

  7. ayjayt commented on Nov 12, 2024

    @ayjayt
    Collaborator

    Hi everyone, I'll add this to my watch. I think the new major release is coming around tomorrow. We're doing our best to squash all bugs and improve debugging before that release.

    The new release of kaleido is a bit different because for many reasons, but majorly, it no longer bundles chrome.

  8. self-assigned this
    on Nov 12, 2024
  9. huonw commented on Feb 26, 2025

    @huonw
    Author

    Heya, just checking in. Is that new release slated soon? It'd be handy to clean these warnings off our allow-list.

  10. ayjayt commented on Feb 26, 2025

    @ayjayt
    Collaborator

    @huonw, hi!

    I'm pretty confident in kaleido and it can be used.

    There is still on-going work preparing documentation, and integrating kaleido into plotly to use fig.write_figure(PATH) which doesn't work yet.

    Because plotly doesn't wrap the new kaleido api properly, Kaleido 1.0.0 is not on pypi yet, but the tags are on github and the kaleido-direct API is fine and stable:

    import kaleido
    kaleido.write_fig_sync(fig, path)

    To install it, since it's on github and not pypi yet,

    $ pip install git+https://github.com/plotly/kaleido@latest-tag#subdirectory=src/py
    
    # Or, to future proof the install,
    
    $ pip install "kaleido>=1.0.0" || pip install git+https://github.com/plotly/kaleido@latest-tag#subdirectory=src/py
    $ kaleido_get_chrome # will install (not to path) a known working version of chrome

    There is more docs here, and here are some API demos. This is my personal API reference if you are interested in improving speed/memory efficiency for batch processing images.

    Please let me know of any issues!

    I am going to close this for now, but am ready to tackle new issues.

  11. huonw commented on Feb 26, 2025

    @huonw
    Author

    Thanks for the update, glad to hear there's progress! Unfortunately we only use this via plotly so we'll have to wait for an update there to be able to resolve the warning in our codebase.

  12. ayjayt commented on Feb 26, 2025

    @ayjayt
    Collaborator

    Ok @huonw, it won't be that much longer until it's integrated with plotly.py so you can use that shortcut API directly from plotly. It will still require you to have installed somewhere a browser or use the tools that come with the kaleido package.

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

Metadata

Metadata

Assignees

Labels

P2needed for current cycleactivebugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions