[BUG]: Plotly doesn't render properly when used in the Colab VS Code extension.
Les mainteneurs répondent en général sous 1 jour
@kevineger y travaille déjà.
Depuis le 21/1/2026.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Description
Hi there 👋, I'm the maintainer of the Colab VS Code extension which we recently launched:
One of our users reported https://github.com/googlecolab/colab-vscode/issues/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.
Steps to reproduce
- Install the Colab VS Code extension
- Create a new Jupyter notebook file
- Click
Select Kernel - Select
Colab - If prompted (first run), sign in to Google
- Author a cell which renders a Plotly plot, e.g.:
import plotly.express as px import pandas as pd import plotly.io as pio data = {'x': [1, 2, 3, 4, 5], 'y': [1, 2, 4, 8, 16], 'text': ['hello', 'world', '!', '!', '!']} df = pd.DataFrame(data) fig = px.scatter(df, x="x", y="y", text="text", title="Hello World Plotly Express") fig.update_traces(textposition='top center') fig.show() - Execute the cell
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!
- Langage dominant
- Python
- Étoiles
- 18.8k
- Forks
- 2.9k
- Merge moyen
- 14 h 12 min
- PR mergées (30 j)
- 19
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de plotly/plotly.py
-
[BUG]: Unnecessary `UserWarning` when using `fig.write_image()` with `kaleido.start_sync_server()`Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
P3 size: 1 task
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
plotly/plotly.py#5769 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
P3 size: 1 task
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
bug P1
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
feature P3
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de plotly/plotly.py
Issues similaires
-
New InternshipOuvertenew_internship
Difficulté 1/5 Moins d'une heure Accessibilité débutants 70/100
-
[BUG] Reports tab: "Unban" button tooltip shows raw `{{ip}}` placeholder instead of the IP addressOuvertebug javascript ui
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
bunkerity/bunkerweb#4001 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
PedestrianDynamics/pyFDS-Evac#476 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
google/differential-privacy#516 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
adobe-fonts/source-serif#153 ·