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

Embedding cell with Plotly plot fails to render when embedding cell from another document #10808

Open
christianbudgetthuis opened this issue Sep 16, 2024 · 0 comments
Assignees
Labels
bug Something isn't working plotly
Milestone

Comments

@christianbudgetthuis
Copy link

Bug description

When embedding a cell from another document, which contains a Plotly plot, in a Qmd file everything works fine. However, when embedding another cell from another document later in the same Qmd file, the Plotly plot fails to render.

The browser outputs:

Failed to load resource: net::ERR_FILE_NOT_FOUND
require.min.js:1  Uncaught Error: Script error for "plotly"
https://requirejs.org/docs/errors.html#scripterror
    at makeError (require.min.js:1:1795)
    at HTMLScriptElement.onScriptError (require.min.js:1:17084)

Steps to reproduce

Reproduce using the following files

doc.qmd

# Plot

{{< embed plot.ipynb#plot >}}

# Table

{{< embed table.ipynb#table >}}

plot.ipynb

#| label: plot
import plotly.express as px
fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
fig.show()

table.ipynb

#| label: table

from great_tables import GT
import pandas as pd

GT(pd.DataFrame(dict(a=[1,2,3],b=[1,2,3])))

When modifying doc.qmd like so:
doc.qmd

# Plot

{{< embed plot.ipynb#plot >}}

# Table

no table

the plot will render.

Expected behavior

The Plotly plot should render irrespectively of other included cells.

Actual behavior

The browser console outputs:

Failed to load resource: net::ERR_FILE_NOT_FOUND
require.min.js:1  Uncaught Error: Script error for "plotly"
https://requirejs.org/docs/errors.html#scripterror
    at makeError (require.min.js:1:1795)
    at HTMLScriptElement.onScriptError (require.min.js:1:17084)

and no plot renders.

Your environment

WSL Ubuntu

Quarto check output

'Quarto 1.5.55
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.55
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Tex:  (not detected)

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.12
      Path: /home/chirche/Documents/test_quarto/.venv/bin/python
      Jupyter: 5.7.2
      Kernels: python3, sparkrkernel, sparkkernel, pysparkkernel

(|) Checking Jupyter engine render....Traceback (most recent call last):
  File "/opt/quarto/share/jupyter/jupyter.py", line 21, in <module>
    from notebook import notebook_execute, RestartKernel
  File "/opt/quarto/share/jupyter/notebook.py", line 15, in <module>
    from yaml import safe_load as parse_string
ModuleNotFoundError: No module named 'yaml'
[✓] Checking Jupyter engine render....OK
@christianbudgetthuis christianbudgetthuis added the bug Something isn't working label Sep 16, 2024
@cscheid cscheid self-assigned this Sep 16, 2024
@cscheid cscheid added this to the Future milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plotly
Projects
None yet
Development

No branches or pull requests

3 participants