Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[BUG]: Blank plot in Jupyterlab when plotly is installed in different virtual env from jupyter server

Ouverte
#5,664 3 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
52/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
jupyter-notebook, python

Piste de recherche

Reproduisez la figure vide avec les deux environnements uv et le kernel installé avec ipython kernel install, puis comparez fig.show() par défaut à fig.show(renderer="notebook"). Commencez par le comportement lié à Jupyter décrit dans l’issue et par la page de dépannage Plotly liée. C’est terminé lorsque l’affichage par défaut fonctionne dans les environnements séparés, ou lorsque la documentation de dépannage explique clairement la configuration requise et la solution de contournement.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug P3 size: 3
Description

I am using plotly in an environment managed by JupyterHub. I created a fresh virtual environment (independent from the one managed by JH, which I don't want to modify). I installed plotly in that virtual environment and added it as a kernel to Jupyter by running ipython kernel install in the virtual environment. However, if I open a Jupyter notebook with this kernel and try to create a plot, I get a blank figure. There is no Javascript error in the browser console.

Screenshots/Video
Image
Steps to reproduce

This can be reproduced by creating a clean virtual environment with only Jupyter in it and then another one which contains plotly:

mkdir /tmp/plotly-issue
cd /tmp/plotly-issue

# ~equivalent to the environment managed by JupyterHub
uv init --bare jupyter-env
cd jupyter-env
uv add jupyterlab

cd ..
uv init --bare kernel-env
cd kernel-env
uv add ipykernel plotly nbformat # "Mime type rendering requires nbformat"
uv run ipython kernel install --prefix /tmp/plotly-issue/jupyter-env/.venv/ --name kernel-with-plotly

cd ../jupyter-env
uv run jupyter lab

Then, in jupyterlab, create a new notebook with the kernel kernel-with-plotly and run

from plotly import graph_objects as go
fig = go.Figure()
fig.add_trace(go.Bar(x=[1, 2, 3], y=[1, 3, 2]))
fig.show()
Notes

The figure works correctly if I replace the last line with fig.show(renderer="notebook"). However, the blank figure was very confusing and it took me several hours to find this solution. Additionally, I found a lot of online discussion pointing to this troubleshooting page: https://plotly.com/python/troubleshooting/ which mentions Jupyter / Jupyterlab in the introduction, but there is no section related to Jupyter in the main text. I think this page should be updated with some additional information on Jupyter.

Langage dominant
Python
Étoiles
18.8k
Forks
2.8k
Merge moyen
13 h 28 min
PR mergées (30 j)
20

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de plotly/plotly.py

Toutes les issues de plotly/plotly.py

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.