-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
When running this cell in a JupyterLab instance:
import plotly.io as pio
pio.renderers.default = "notebook_connected"
import plotly.graph_objects as go
go.Figure()The first time Plotly is loaded, the figure is blank and the following errors appear in the dev console:
GET https://cdn.plot.ly/plotly-3.0.1.min net::ERR_ABORTED 403 (Forbidden)
Uncaught ReferenceError: Plotly is not defined
at <anonymous>:1:179
at P.attachWidget (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1859455)
at P.insertWidget (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1858919)
at M._insertOutput (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1282454)
at M.onModelChanged (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1278810)
at m (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1832098)
at Object.l [as emit] (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1831774)
at a.emit (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1829611)
at d._onListChanged (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1273587)
at m (jlab_core.a4c5e1f5bac9ba5dc7f6.js?v=a4c5e1f5bac9ba5dc7f6:1:1832098)
When running the cell for a second time, the figure appears. If the page is refreshed, the figure disappears again.
It looks like the issue can be traced back to this line, where .js is removed from the CDN path:
plotly.py/plotly/io/_base_renderers.py
Line 286 in ae0fbed
| plotly_cdn=plotly_cdn_url().rstrip(".js"), |
This is with Python 3.11.11, Plotly 6.0.1 and Jupyterlab 4.3.6, and occurs in both Chrome and Edge.
anyio==4.9.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
arrow==1.3.0
asttokens==3.0.0
async-lru==2.0.5
attrs==25.3.0
babel==2.17.0
beautifulsoup4==4.13.3
bleach==6.2.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
comm==0.2.2
debugpy==1.8.13
decorator==5.2.1
defusedxml==0.7.1
executing==2.2.0
fastjsonschema==2.21.1
fqdn==1.5.1
h11==0.14.0
httpcore==1.0.7
httpx==0.28.1
idna==3.10
ipykernel==6.29.5
ipython==9.0.2
ipython_pygments_lexers==1.1.1
isoduration==20.11.0
jedi==0.19.2
Jinja2==3.1.6
json5==0.10.0
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter-lsp==2.2.5
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyter_server==2.15.0
jupyter_server_terminals==0.5.3
jupyterlab==4.3.6
jupyterlab_pygments==0.3.0
jupyterlab_server==2.27.3
MarkupSafe==3.0.2
matplotlib-inline==0.1.7
mistune==3.1.3
narwhals==1.31.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nest-asyncio==1.6.0
notebook_shim==0.2.4
overrides==7.7.0
packaging==24.2
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
platformdirs==4.3.7
plotly==6.0.1
prometheus_client==0.21.1
prompt_toolkit==3.0.50
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycparser==2.22
Pygments==2.19.1
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
PyYAML==6.0.2
pyzmq==26.3.0
referencing==0.36.2
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.23.1
Send2Trash==1.8.3
six==1.17.0
sniffio==1.3.1
soupsieve==2.6
stack-data==0.6.3
terminado==0.18.1
tinycss2==1.4.0
tornado==6.4.2
traitlets==5.14.3
types-python-dateutil==2.9.0.20241206
typing_extensions==4.12.2
uri-template==1.3.0
urllib3==2.3.0
wcwidth==0.2.13
webcolors==24.11.1
webencodings==0.5.1
websocket-client==1.8.0
It still doesn't work when downgrading to Plotly 5.24.1, although the console error is slightly different:
Uncaught ReferenceError: require is not defined
at <anonymous>:1:17
at P.attachWidget (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1859455)
at P.insertWidget (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1858919)
at M._insertOutput (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1282454)
at M.onModelChanged (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1278810)
at m (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1832098)
at Object.l [as emit] (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1831774)
at a.emit (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1829611)
at d._onListChanged (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1273587)
at m (jlab_core.a4c5e1f5ba…9ba5dc7f6:1:1832098)
When exporting to html with nbconvert, the 403 error still appears but the plot displays. Changing line 7568 of the attached html file to <script type="module">import "https://cdn.plot.ly/plotly-3.0.1.min.js"</script> removes the error from the console.