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

6.0.0 fails to export WebGL to HTML file #5012

Open
janba opened this issue Feb 5, 2025 · 1 comment
Open

6.0.0 fails to export WebGL to HTML file #5012

janba opened this issue Feb 5, 2025 · 1 comment

Comments

@janba
Copy link

janba commented Feb 5, 2025

Plotly version 6.0.0 fails to output figure with WebGL content.

I create a 3D figure composed of Mesh3D and Scatter3D objects. The figure is shown using:

import plotly.graph_objs as go
import plotly.offline as py
# ...
fig = go.Figure(data=mesh_data, layout=lyt)
py.iplot(fig)

The figure displays fine - also in v 6.0.0 but when exporting to HTML, the resulting html file just has a blank space where the figure should be. It works as expected in 5.24.1 where the interactive graphics is present in the output html file.

When I display the web page and look a the source control, I see this error:

Image

Note that this is using MacOS and Safari, but it appears irrelevant whether I use Python 3.11 or 3.13. It also does not seem to matter whether I export from VS Code or Jupyter notebook. I am using plotly in teaching and became aware of the problem since students reported it on other platforms, so I am fairly confident it is an issue with Plotly.py - specifically plotly.offline. The workaround is, of course, to downgrade to 5.24.1.

Thanks!

@arnaudh
Copy link

arnaudh commented Feb 6, 2025

Also bumping into this issue. Here is the error in text form, to make it easy for others to find this issue:

big.html:40875 Uncaught TypeError: kP.select is not a function
    at Ehe (big.html:40875:259206)
    at Object.Yft [as _doPlot] (big.html:40875:255283)
    at Object.Qft [as newPlot] (big.html:40875:260707)
    at big.html:44733:344

We run into this on MacOS and linux. We export to HTML using papermill nbformat and nbconvert like so:

  
    import nbformat
    import papermill
    from nbconvert import HTMLExporter

    # Execute the notebook
    papermill.execute_notebook(
        input_path=input_nb_path,
        output_path=output_nb_path,
    )

    # Convert the executed notebook to HTML
    with open(output_nb_path) as f:
        nb_content = f.read()
        notebook = nbformat.reads(nb_content, as_version=4)
        html_exporter = HTMLExporter(template_name="lab")
        (html, _) = html_exporter.from_notebook_node(notebook)
        with open(output_html_path, "w") as f:
            f.write(html)

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