-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
graphs from plotly >= 5.8 don't render in databricks #3756
Comments
How to fix:
import plotly.io._html as piohtml
piohtml._mathjax_config = """<script type="text/javascript">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}</script>""" Background: 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: |
Thanks @fwetdb! I'm embarrassed that that got through code review 🙈 |
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 ? |
No need for a PR, I can do it. I will try to do a point release tonight or tomorrow morning. |
Awesome, thank you for the fast reaction! |
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? |
@fwetdb I can't reply to a closed question either, sorry |
(actually I can comment, and I did) |
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 !pip install plotly==5.8.1
import plotly
plotly.__version__ # 5.8.1
import plotly.io._html as piohtml
display(piohtml._mathjax_config) # still contains the duplicate &&
import plotly.express as px
df = px.data.medals_long()
fig = px.bar(df, x="medal", y="count", color="nation")
fig This still shows the error (because the mathjax config is still the old one). What do you think @nicolaskruchten ? |
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! |
Another release, coming up! |
OK here we go: https://github.com/plotly/plotly.py/releases/tag/v5.8.2 Sorry and thanks for pointing this out :) |
Great, thank you and I validated that 5.8.2 works as expected. |
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 '&&'
:The text was updated successfully, but these errors were encountered: