"Javascript Error: Cannot set properties of null" with JupyterLab & Plotly surface plots:

When I run the following code snippet in a python script or in Jupyter notebook, I get the expected 3d surface plot result:

import torch 
import plotly.graph_objects as go

zz = torch.rand(33,33)
x = torch.linspace(0, 1, steps=zz.shape[-2]).numpy()
y = torch.linspace(0, 1, steps=zz.shape[-1]).numpy()

fig = go.Figure(data=[go.Surface(z=zz.cpu().numpy(), x=x, y=y)])
fig.show()

But when I try to run that in Jupyter Lab, I get this picture instead:

[“Sorry new users can only put one embedded media item in a post”]
?? Ok, well imagine a blank screen with a dark bar on the bottom that reads:
Javascript Error: Cannot set properties of null (setting '0')

Does anyone know how to fix this? I have tried multiple versions of Plotly, Juptyer, both pip and conda environments, different web browsers. Everything is fine except for when I try to render a surface plot in Juptyer Lab.

For example, here are two different environments where the problem occurs:

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.11.0
ipykernel        : 6.22.0
ipywidgets       : 8.0.4
jupyter_client   : 8.1.0
jupyter_core     : 5.3.0
jupyter_server   : 2.5.0
jupyterlab       : 3.6.3
nbclient         : 0.7.2
nbconvert        : 7.2.10
nbformat         : 5.8.0
notebook         : 6.5.3
qtconsole        : 5.4.1
traitlets        : 5.9.0

$ pip list | grep plotly 
plotly                    5.14.1

…And in another…

jupyter --version
Selected Jupyter core packages...
IPython          : 8.8.0
ipykernel        : 6.20.1
ipywidgets       : 8.0.4
jupyter_client   : 7.4.8
jupyter_core     : 5.1.3
jupyter_server   : 2.0.6
jupyterlab       : 3.5.2
nbclient         : 0.7.2
nbconvert        : 7.2.7
nbformat         : 5.7.1
notebook         : 6.5.2
qtconsole        : 5.4.0
traitlets        : 5.8.1

with

plotly                    5.11.0             pyhd8ed1ab_1    conda-forge

I’ll try again to paste the error screen I see in Juptyer Lab: