FigureWidget + go.Image.source breaks notebook kernel in VSCode
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
I encounter a bug in VSCode notebook when using a FigureWidget for a go.Image trace using source string instead of z attribute (px.imshow optimization).
The bug is: once you hover the image with mouse the kernel is unresponsive, i.e. you can't run any cell anymore.
The bug is not present when running the notebook through Jupyter web interface.
Reproducible example
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.utils import image_array_to_data_uri
img = (np.random.rand(10, 10, 3) * 255).astype(np.uint8)
img_str = image_array_to_data_uri(img)
# --- Using normal go.Figure is OK
# px.imshow(img) # OK
# go.Figure(go.Image(z=img)) # OK
# go.Figure(go.Image(source=img_str)) # OK
# --- Using go.FigureWidget and Image.z is OK
# go.FigureWidget(go.Image(z=img)) # OK
# --- Using go.FigureWidget and Image.source is NOT OK
# go.FigureWidget(px.imshow(img)) # NOK
go.FigureWidget(go.Image(source=img_str)) # NOK
Versions
$ conda list | grep -E 'plotly|ipykernel|pillow|numpy|pandas'
ipykernel 6.26.0 pyhf8b6a83_0 conda-forge
numpy 1.26.0 py312heda63a1_0 conda-forge
pandas 2.1.3 py312hfb8ada1_0 conda-forge
pillow 10.1.0 py312hf3581a9_0 conda-forge
plotly 5.18.0 pyhd8ed1ab_0 conda-forge
$ code --version
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das bereitgestellte FigureWidget-Beispiel in einem VSCode-Notebook und vergleiche go.Image(source=...) mit go.Image(z=...) sowie dem entsprechenden Jupyter-Weblauf. Verfolge die durch das Überfahren des quellengestützten Bildes ausgelöste FigureWidget-Notebook-Interaktion; das Issue ist abgeschlossen, wenn das Überfahren den Kernel nicht mehr reaktionslos zurücklässt und die normale Ausführung von Zellen fortgesetzt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- jupyter-notebook, python, vscode
- Bereich
- data-visualization, frontend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100