jupyter notebook的升级与重装:(解决python版GEE(geemap),生成Map图标缺失问题,Failed to load model class ‘VBoxModel‘ ...)

最近有朋友问我geemap生成地图的时候,左上角和右上角的工具标(如图)缺失了,该咋办,观察了一下发现是 jupyter 版本问题,JupyterLab中的@jupyter-widgets/controls模块版本不匹配,需要升级。因此本文分享一下升级办法。

下面是报错的具体信息。

[Open Browser Console for more detailed log - Double click to close this message] Failed to load model class 'VBoxModel' from module '@jupyter-widgets/controls' Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however, 2.0.0 is at f.loadClass (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.a63a8d293fb35a52dc25.js?v=a63a8d293fb35a52dc25:1:75057) at f.loadModelClass (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:10729) at f._make_model (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:7517) at f.new_model (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:5137) at f.handle_comm_open (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.ebc7a55ea1768712771f.js?v=ebc7a55ea1768712771f:1:3894) at _handleCommOpen (http://localhost:8889/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.a63a8d293fb35a52dc25.js?v=a63a8d293fb35a52dc25:1:73473) at v._handleCommOpen (http://localhost:8889/static/notebook/3676.bundle.js:1:30808) at async v._handleMessage (http://localhost:8889/static/notebook/3676.bundle.js:1:32702)

废话不多说,直接上方法:

注意:以下所有步骤都是在当前环境下的终端运行;如果使用jupyter notebook也可以运行下面的命令,在每行命令前面加上英文感叹号!,如:!pip install --upgrade jupyterlab ipywidgets(但不建议用Jupyter notebook,因为本身就是对jupyter notebook进行重装)

1. 首先,卸载现有的 JupyterLab 扩展:

jupyter labextension uninstall @jupyter-widgets/jupyterlab-manager

2. 然后,重新安装所需的扩展:

jupyter labextension install @jupyter-widgets/jupyterlab-manager@latest

3. 确保 JupyterLab 和 ipywidgets 都是最新版本:

pip install --upgrade jupyterlab ipywidgets

4. 接下来,重建 JupyterLab:

jupyter lab build

5. 如果使用的是 JupyterLab 3.x 版本,可以使用以下命令:

pip install jupyterlab_widgets
jupyter labextension install @jupyter-widgets/jupyterlab-manager

6. 确保所有相关包之间的版本兼容。可以使用 jupyterlab_widgets,能解决大多数兼容性问题:

pip install jupyterlab_widgets

7. 最后,重启 JupyterLab 并检查问题是否解决。

注意:如果中间有一步出现了错误,那么接着运行下面的步骤,不用管上一步的错误。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值