连接Colab本地运行时加载Jupyter Notebook扩展出现ImportError
问题根因
该报错为Jupyter服务扩展配置列表中残留了无效的py条目,启动时Jupyter会尝试加载不存在的py模块触发报错,该警告不影响Jupyter本身的基础运行,仅为冗余错误提示。
解决方案
执行以下步骤即可修复:
- 查看当前已启用的Jupyter服务扩展列表,执行命令:
jupyter serverextension list - 在输出结果中找到状态为无效的
py扩展条目,执行命令移除错误配置:jupyter serverextension disable py - 若执行上述命令后仍有报错,可添加
--system参数执行全局范围的配置移除:jupyter serverextension disable py --system - 重新执行Colab本地运行时启动命令,验证报错已消失:
jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=9090 --NotebookApp.port_retries=0
补充说明
该无效配置一般是此前安装第三方Python包时,错误写入Jupyter扩展列表导致,和Colab本地运行时依赖的jupyter_http_over_ws扩展无冲突,移除后不会影响现有Jupyter功能和Colab本地连接的正常使用。
内容的提问来源于stack exchange,提问作者NotArobot
相关产品推荐
相关产品推荐

