matplotlib / matplotlib/ipympl
%matplotlib widget run time error
还没有人认领这个 Issue。
- 主要语言
- Jupyter Notebook
- 星标
- 1.7k
- 派生
- 234
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello,
I saw an old issue about this topic, but I could not find a recent solution.
I am using a Linux machine, Python version 3.12.4. I created my environment and I installed matplotlib by using
`pip install matplotlib`
But when I run my code in VS code, I get a runtime error related to %matplotlib widget
> RuntimeError Traceback (most recent call last)
> File ~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:413, in BackendRegistry.resolve_gui_or_backend(self, gui_or_backend)
> [412](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:412) try:
> --> [413](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:413) return self.resolve_backend(gui_or_backend)
> [414](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:414) except Exception: # KeyError ?
>
> File ~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:375, in BackendRegistry.resolve_backend(self, backend)
> [374](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:374) if gui is None:
> --> [375](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:375) raise RuntimeError(f"'{backend}' is not a recognised backend name")
> [377](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:377) return backend, gui if gui != "headless" else None
>
> RuntimeError: 'widget' is not a recognised backend name
>
> During handling of the above exception, another exception occurred:
>
> RuntimeError Traceback (most recent call last)
> Cell In[3], [line 8](vscode-notebook-cell:?execution_count=3&line=8)
> [3](vscode-notebook-cell:?execution_count=3&line=3) from pathlib import Path
> [5](vscode-notebook-cell:?execution_count=3&line=5) #import ephyviewer
> [6](vscode-notebook-cell:?execution_count=3&line=6) #import spikeinterface_gui as sigui
> ----> [8](vscode-notebook-cell:?execution_count=3&line=8) get_ipython().run_line_magic('matplotlib', 'widget')
> [9](vscode-notebook-cell:?execution_count=3&line=9) get_ipython().run_line_magic('matplotlib', 'inline')
> [10](vscode-notebook-cell:?execution_count=3&line=10) #%matplotlib notebook
> ...
> [414](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:414) except Exception: # KeyError ?
> --> [415](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:415) raise RuntimeError(
> [416](https://file+.vscode-resource.vscode-cdn.net/home/Paola/Documents/~/.conda/envs/s_i/lib/python3.12/site-packages/matplotlib/backends/registry.py:416) f"'{gui_or_backend} is not a recognised GUI loop or backend name")
>
> RuntimeError: 'widget is not a recognised GUI loop or backend name
Have you found a solution for this issue?
thank you
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在所报告的 Linux、Python 3.12.4 和 VS Code 环境中复现 `%matplotlib widget`,然后检查 `matplotlib/backends/registry.py` 中显示的后端解析路径。将其行为与 ipympl 和 Jupyter 的集成设置进行比较;确定了此配置的原因和可复现的解决方案后,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter-notebook, matplotlib, python, vscode
- 领域
- frontend, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100