Plotly output generated with 'notebook' renderer not shown after re-opening notebook
See original GitHub issueEnvironment data
- VS Code version: 1.58.0-insider
- Jupyter Extension version (available under the Extensions sidebar): v2021.7.978384885
- Python Extension version (available under the Extensions sidebar): v2021.7.969414671-dev
- OS (Windows | Mac | Linux distro) and version: Win 10.0.19043
- Python and/or Anaconda version: 3.9.0 64-bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Jupyter server running: Local
Expected behaviour
Plotly graphs are shown after re-opening a saved Jupyter notebook with these graphs
Actual behaviour
The ouput is blank after re-opening a notebook that contains cell output using the Plotly ‘notebook’ renderer. The graphs are shown correctly after re-executing the affected cells. Related to the fix for #6334 and merge #6318 with which support for the ‘notebook’ renderer was added.
Log output:
VM12:5 Uncaught TypeError: require.undef is not a function
at <anonymous>:5:17
at h (vscode-webview://f620ad82-e8b9-40f2-a1ab-808101a5c2a2/notebookWebviewPreloads.js:3)
at vscode-webview://f620ad82-e8b9-40f2-a1ab-808101a5c2a2/notebookWebviewPreloads.js:3
resourceLoading.ts:82 Error: Unable to read file 'c:\Temp\plotly.js' (Error: Unable to resolve non-existing file 'c:\Temp\plotly.js')
at ai.doReadFileStream (fileService.ts:539)
at async Object.w [as loadLocalResource] (resourceLoading.ts:68)
at async u.loadResource (baseWebviewElement.ts:530)
plotly.js:1 Failed to load resource: the server responded with a status of 404 ()
VM14:4 Registering custom require.js for Jupyter Kernel
The logs indicate that require.js is available only after the initial try to display the cell content which fails with 404.
Steps to reproduce:
import plotly.express as px
df = px.data.gapminder()
fig = px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animation_group="country",
size="pop", color="continent", hover_name="country",
log_x=True, size_max=55, range_x=[100,100000], range_y=[25,90])
fig.show(renderer='notebook')
- Run notebook confirming that graphs are working normal
- Save notebook
- Close and re-open notebook
- Only blank cell output is shown where the graph should be
- Re-running the notebook creates the graph again
Logs
Output for Jupyter
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Jupyter
)
XXX
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:22 (18 by maintainers)
Top Results From Across the Web
Troubleshooting in Python - Plotly
The easiest solution is to force the notebook renderer to reload by calling fig.show("notebook") instead of just fig.show() . If this problem is...
Read more >Plotly chart not showing in Jupyter notebook - Stack Overflow
As of Plotly version 5.0, I am able to create a new conda environment with Python 3.9 and then pip install plotly jupyterlab...
Read more >Re: Offline plot.ly does not render in a published notebook in a ...
Not publish that notebook on a dashboard. Neither the dashboard rendering or insight rendering show the graph - just a blank. import dataiku...
Read more >Plotting Financial Data Chart with Plotly Python Library for ...
This article demonstrates how to use Plotly Python library to plot interactive chart on Jupyter Notebook using dataset from Eikon Data API.
Read more >Interactive Plots — FiftyOne 0.18.0 documentation - Voxel51
With FiftyOne, you can visualize geolocated data on maps, generate ... Support for interactive plots in non-notebook contexts and in Google Colab is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
LGTM now, thanks!
@DonJayamanne I tried to run the original code snippet in the issue description but the output is not rendered and here are the logs in devtools