You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: Plotly doesn't render properly when used in the Colab VS Code extension.聽#5471
One of our users reported googlecolab/colab-vscode#339. Summarized, today Plotly doesn't render properly in VS Code when using the Colab extension. This requires users to manually configure the default renderer, instead of being able to lean on Plotly's detection.
Expected behaviour: plot is rendered as it does if you set pio.renderers.default = "vscode" before showing the plot.
Actual behaviour: nothing is rendered. You can Copy cell output and see the HTML output that's returned instead. This works in web-based Colab.
Notes
As you'll see in my reply, this seems to be caused by this block in Plotly, where the default_renderer gets set to colab. If I set plotly.io.renderers.default to 'plotly_mimetype' or 'vscode', everything works as intended.
Unfortunately, VS Code doesn't set VSCODE_PID for these remote Colab kernels, so we can't simply re-order the default renderer checks. One possible solution is to extend the Colab check from only looking for import google.colab to also check for COLAB_NOTEBOOK_ID, which I believe (need to double check) is only set for web-based Colab. Feels a bit brittle. Open to suggestions, and happy to send a PR once we reach consensus!
Thanks for the bug report! Our team doesn't have a lot of experience with this extension, so we can't speak to alternative solutions. If you want to investigate options and propose a solution, we can have a discussion and figure out a path forward.
Gotcha. Currently I think checking for COLAB_NOTEBOOK_ID is our only reasonable option. I've confirmed it gets set on kernel init only for out web client. Here's a PR with the proposed change: #5473.
Activity
camdecoster commentedon Jan 21, 2026
Thanks for the bug report! Our team doesn't have a lot of experience with this extension, so we can't speak to alternative solutions. If you want to investigate options and propose a solution, we can have a discussion and figure out a path forward.
Set the 'colab' renderer only for Colab web notebooks
kevineger commentedon Jan 21, 2026
Gotcha. Currently I think checking for
COLAB_NOTEBOOK_IDis our only reasonable option. I've confirmed it gets set on kernel init only for out web client. Here's a PR with the proposed change: #5473.kevineger commentedon Mar 17, 2026
Could someone take a look at the PR I sent?
#5473
Set the 'colab' renderer only for Colab web notebooks