Closed
Description
I am building a shiny for python dashboard. On the latest deployment plotly updated from 5.24.1 -> 6.0.0 and the plots no longer render with the error: "Please install anywidget to use the FigureWidget class". For now I have worked around the issue by specifying the version in my requirements.txt file plotly==5.24.1
Activity
igi-chris commentedon Jan 29, 2025
For a reproducible example you can use one of the template apps provided by shiny that uses plotly e.g. the dashboard-tips template. Once you have shiny installed you can download the template with
shiny create --template dashboard-tips --mode express --github posit-dev/py-shiny-templates
, set up a virtual env and install the dependencies in the downloaded requirements.txt file.Using plotly 6.0.0 the plots fail as shown in the screenshot below:

However, if you downgrade plotly to 5.24.1 the dashboard renders as expected:

Here is the full traceback (from the 6.0.0 version):
ndrezn commentedon Jan 29, 2025
@marthacryan I see that
anywidget
is only inrequires-optional
: https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/requires-optional.txt#L51 Should it go into arequires-jupyter
or elsewhere so that it's easier to know what to install?This is a UX recommendation; the fix for this issue @igi-chris might be for Posit to update their templates.
You can also:
manually in your environment to resolve the issue.
marthacryan commentedon Jan 29, 2025
I agree! One thing I'll note though is that this is identical to the behavior before the 6.0.0 release except that
ipywidgets
was substituted foranywidget
as the package required. We should at the very least update the wording of the error to saypip install anywidget
for clarity.turbotimon commentedon Feb 11, 2025
Please also note this line from the v6.0 release notes (it was the reason why my code failed even with
anywidget
manually installed):Edit: No, I'm still now able to get FigureWidget to work in v6.0.0. Only downgrading solves the problem: #5027
FigureWidget
fails withanywidget
in colab #5027gvwilson commentedon Jun 17, 2025
@turbotimon apologies for the slow response - when you say "still now able to get FigureWidget to work with v6.0.0" do you mean "still not able"? thanks - @gvwilson
turbotimon commentedon Jun 18, 2025
@gvwilson sorry for the unclear wording. Yes, I meant "still not able". However, I just retried my test example with
plotly==6.1.2 anywidget==0.9.18
and it seems to work fine now👍 (There is still a strange behavior in colab tough, but it works in vscode notebooks #5027 (comment))