[BUG]: Blank plot in Jupyterlab when plotly is installed in different virtual env from jupyter server
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #5692 來自 @tomatotomata —— 已合併
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 52/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- jupyter-notebook, python
研究方向
使用兩個 uv 環境以及透過 ipython kernel install 安裝的核心重現空白圖,然後比較預設的 fig.show() 與 fig.show(renderer="notebook")。先從 issue 中描述的 Jupyter 相關行為和連結的 Plotly 疑難排解頁面開始。完成標準是預設顯示在彼此獨立的環境中都能正常運作,或者疑難排解文件清楚說明所需的設定和替代方案。
由索引模型根據 Issue 內容生成。
描述
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
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.
- 主要語言
- Python
- 星號
- 18.8k
- 分支
- 2.9k
- 平均合併
- 14 小時 12 分鐘
- 30 天內合併 PR
- 19
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/plotly.py 的其他 Issue
-
[BUG]: Unnecessary `UserWarning` when using `fig.write_image()` with `kaleido.start_sync_server()`可能已有人在做 @jayzhou2309 於 3 天前認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
P3 size: 1 task
難度 2/5 1-3 小時 新手友好度 65/100
plotly/plotly.py#5769 · 1 個 reaction ·
維護者通常 1 天內回覆
-
Remove `@types/plotly.js` dependency可能已有人在做 @Belagum 於 19 天前認領。 未關閉P3 size: 1 task
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug P1
難度 1/5 1 小時以內 新手友好度 68/100
維護者通常 1 天內回覆
-
feature P3
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
相似的 Issue
-
bug llm translation
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
Arkansas 2025 tax is $1.70 high above $100,000 net taxable income ($3,809 + 3.9% rule)可能已有人在做 @PavelMakarchuk 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
PolicyEngine/policyengine-us#9828 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
jellyfin/jellyfin-mpv-shim#800 ·
維護者通常 1 天內回覆
-
skillfs: one malformed chat-log line aborts the entire skill-usage analysis (skill_usage_from_chat_logs.py)可能已有人在做 @zjncs 今天認領。 未關閉component:skillfs
難度 2/5 1-3 小時 新手友好度 82/100
agentic-os-org/ANOLISA#6116 · 1 則留言 ·
維護者通常 1 天內回覆
-
P4: low query
難度 2/5 1-3 小時 新手友好度 76/100
jeffknupp/association#336 ·