Skip to content
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

ipywidgets=8.0.5 breaks FigureWidget #4120

Closed
hmgaudecker opened this issue Mar 22, 2023 · 2 comments
Closed

ipywidgets=8.0.5 breaks FigureWidget #4120

hmgaudecker opened this issue Mar 22, 2023 · 2 comments

Comments

@hmgaudecker
Copy link

The creation of FigureWidget below works fine with ipywidgets=8.0.4, but breaks in 8.0.5 with the error shown below.

import pandas as pd
import plotly.graph_objects as go

df = pd.DataFrame.from_dict(
    {
        "x0": {"0": -1.0, "1": -0.5},
        "y0": {"0": 0.5, "1": -0.5},
        "x1": {"0": -0.5, "1": 0.0},
        "y1": {"0": -0.5, "1": -1.0},
    }
)

arrows = [
    go.layout.Annotation(
        x=df["x1"][i],
        y=df["y1"][i],
        ax=df["x0"][i],
        ay=df["y0"][i],
    )
    for i in range(len(df))
]

fig = go.FigureWidget(layout=go.Layout(annotations=arrows))
Traceback (most recent call last):
  File "min_test.py", line 24, in <module>
    fig = go.FigureWidget(layout=go.Layout(annotations=arrows))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/plotly/graph_objs/_figurewidget.py", line 629, in __init__
    super(FigureWidget, self).__init__(data, layout, frames, skip_invalid, **kwargs)
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/plotly/basewidget.py", line 117, in __init__
    super(BaseFigureWidget, self).__init__(
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/plotly/basedatatypes.py", line 461, in __init__
    super(BaseFigure, self).__init__()
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/ipywidgets/widgets/widget.py", line 504, in __init__
    self.open()
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/ipywidgets/widgets/widget.py", line 535, in open
    self.comm = create_comm(**args)
                ^^^^^^^^^^^^^^^^^^^
  File "miniconda3/envs/gettsim/lib/python3.11/site-packages/comm/__init__.py", line 27, in _create_comm
    raise NotImplementedError("Cannot ")
NotImplementedError: Cannot 
@AaronStiff
Copy link
Contributor

Looks like ipykernel.comm.Comm was deprecated and ipywidgets updated it. See jupyter-widgets/ipywidgets#3533 and specifically this comment: jupyter-widgets/ipywidgets#3533 (comment)

@hmgaudecker
Copy link
Author

No errors anymore with ipywidgets 8.0.6 and plotly 5.14.1, so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants