FigureWidget + go.Image.source breaks notebook kernel in VSCode
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 VSCode notebook 中复现所提供的 FigureWidget 示例,对比 go.Image(source=...) 与 go.Image(z=...) 以及等效的 Jupyter Web 运行。跟踪悬停在基于 source 的图像上所触发的 FigureWidget notebook 交互;当悬停不再导致 kernel 无响应且单元格能够继续正常执行时,该 issue 即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter-notebook, python, vscode
- 领域
- data-visualization, frontend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100