You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
graphs from plotly >= 5.8 don't render in databricks #3756
displaying a python figure in an iframe within databricks works with plotly==5.7 but when I attempt to do it using 5.8 it fails with Uncaught SyntaxError: Unexpected token '&&':
Background:
This error affects Databricks notebooks with plotly==5.8.0 (and potentially other environments that use a Plotly HTML renderer)
I stumbled across this as part of my work for Databricks.
You're welcome! I am glad that I could help! Without plotly being so widely used and open-source at the same time, this fix (including the investigation) would have been neither needed nor possible.
What are your thoughts on the timeline when the fix can be released, @nicolaskruchten ?
Should I open a PR or will you do it internally?
There is a stackoverflow question that relates to this. I wanted to comment but I do not have enough reputation for that. Also, I was not able to answer.
Huh, that's very strange. I'll admit I didn't do this check myself, I merged the PR and ran the build process so something must be wrong with the build process :(
Activity
fwetdb commentedon Jun 7, 2022
How to fix:
Until the fix is released by plotly on pypi, users can self-fix via adding the following code to their python scripts or notebooks:
Background:
This error affects Databricks notebooks with plotly==5.8.0 (and potentially other environments that use a Plotly HTML renderer)
I stumbled across this as part of my work for Databricks.
The root cause of the error is in https://github.com/plotly/plotly.py/blob/HEAD/packages/python/plotly/plotly/io/_html.py#L23
There is a duplicate, consequent
&&The line should say:
if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\nicolaskruchten commentedon Jun 7, 2022
Thanks @fwetdb! I'm embarrassed that that got through code review 🙈
fwetdb commentedon Jun 7, 2022
You're welcome! I am glad that I could help! Without plotly being so widely used and open-source at the same time, this fix (including the investigation) would have been neither needed nor possible.
What are your thoughts on the timeline when the fix can be released, @nicolaskruchten ?
Should I open a PR or will you do it internally?
nicolaskruchten commentedon Jun 7, 2022
No need for a PR, I can do it. I will try to do a point release tonight or tomorrow morning.
fwetdb commentedon Jun 7, 2022
Awesome, thank you for the fast reaction!
fwetdb commentedon Jun 7, 2022
There is a stackoverflow question that relates to this. I wanted to comment but I do not have enough reputation for that. Also, I was not able to answer.
Can someone refer them to this issue?
https://stackoverflow.com/questions/72466969/plotly-uncaught-syntaxerror-unexpected-token
fixes type and closes #3756
Merge pull request #3763 from plotly/fix_and_and
nicolaskruchten commentedon Jun 8, 2022
@fwetdb I can't reply to a closed question either, sorry
nicolaskruchten commentedon Jun 8, 2022
(actually I can comment, and I did)
nicolaskruchten commentedon Jun 8, 2022
https://github.com/plotly/plotly.py/releases/tag/v5.8.1 is out!
fwetdb commentedon Jun 9, 2022
I tried to verify the bug fix but it seems to me like the release does not contain the new code?
Here is what I executed both in a cell both in Databricks and in a binder notebook e.g. the one at bamboolib.com/demo
This still shows the error (because the mathjax config is still the old one).
What do you think @nicolaskruchten ?
nicolaskruchten commentedon Jun 10, 2022
Huh, that's very strange. I'll admit I didn't do this check myself, I merged the PR and ran the build process so something must be wrong with the build process :(
I'll dig into it and do another release. Sorry!
nicolaskruchten commentedon Jun 10, 2022
Another release, coming up!
nicolaskruchten commentedon Jun 10, 2022
OK here we go: https://github.com/plotly/plotly.py/releases/tag/v5.8.2
Sorry and thanks for pointing this out :)
fwetdb commentedon Jun 10, 2022
Great, thank you and I validated that 5.8.2 works as expected.
Again, awesome response time!