Mar*_*iti 12 python matplotlib jupyter
我正在尝试安装 jupyter-matplotlib 扩展,但无法使其在 jupyterlab 实例中工作。按照此处的步骤安装后:
https : //github.com/matplotlib/jupyter-matplotlib
执行简单示例时出现错误:
错误显示小部件:找不到模型

这是我$ conda list的相关包的输出:
ipykernel 5.1.1
ipympl 0.2.1
ipython 7.6.1
ipython_genutils 0.2.0
ipywidgets 7.5.0
jupyter_client 5.3.1
jupyter_core 4.4.0
jupyterlab 1.0.2
jupyterlab.0server 1.0
首先你需要安装:
pip install ipywidgets
conda install -c conda-forge ipympl
Run Code Online (Sandbox Code Playgroud)
然后检查以下内容是否正常:
!jupyter labextension list
Run Code Online (Sandbox Code Playgroud)
你应该看到这样的东西:
JupyterLab v3.0.14
/home/jovyan/.local/share/jupyter/labextensions
jupyter-leaflet v0.15.0 enabled OK
jupyterlab-plotly v5.1.0 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
Run Code Online (Sandbox Code Playgroud)
最重要的部分在这里:
重新启动您的 jupyter 笔记本。
解决了!结果发现 ipywidget 7.5 破坏了 jupyter 实验室,它也影响了其他库。
https://github.com/plotly/plotly.py/issues/1659
降级到 7 为我解决了这个问题(尽管 7 wrt 7.5 应该向后兼容)!
还要确保将 ipympl 0.2.1 与 jupyter-matplotlib 0.3.0 labextension 匹配。
jupyter labextension install jupyter-matplotlib@0.3.0