【问题标题】:Import error when loading Jupyter Notebook Extensions加载 Jupyter Notebook Extensions 时出现导入错误
【发布时间】:2021-12-10 02:17:35
【问题描述】:

我一直在尝试按照https://research.google.com/colaboratory/local-runtimes.html 上的指南连接 Google Colaboratory 中的本地运行时。运行“jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=9090 --NotebookApp.port_retries=0”时会产生以下错误消息:

jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[W 05:31:57.155 NotebookApp] Error loading server extension py
    Traceback (most recent call last):
      File "C:\ProgramData\Miniconda3\lib\site-packages\notebook\notebookapp.py", line 1934, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "C:\ProgramData\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'py'
[I 05:31:57.157 NotebookApp] Serving notebooks from local directory: C:\data
[I 05:31:57.157 NotebookApp] Jupyter Notebook 6.1.1 is running at:
[I 05:31:57.157 NotebookApp] http://localhost:9090/?token=7da2b30d93fc4e57bb4bfd4db2dcf4ce621d40f92f1f2846
[I 05:31:57.157 NotebookApp]  or http://127.0.0.1:9090/?token=7da2b30d93fc4e57bb4bfd4db2dcf4ce621d40f92f1f2846
[I 05:31:57.158 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 05:31:57.161 NotebookApp]

该错误与Error loading Jupyter Notebook Extensions 有点相似,但是 jupyter_nbextensions_configurator 似乎不涉及这种情况。无论环境如何,错误都是相同的。重新安装 jupyter 和扩展没有帮助。

非常感谢任何帮助!

【问题讨论】:

标签: python jupyter-notebook google-colaboratory


【解决方案1】:

在代码中挖掘了一下,发现要加载的扩展配置在:

/.jupiter/jupyter_notebook_config.json.

配置文件包含错误条目,删除此条目即可解决问题。

卸载并重新安装 jupyter_contrib_nbextensions 会重新引入此问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-24
    • 1970-01-01
    • 2019-06-11
    • 1970-01-01
    • 2019-06-11
    • 1970-01-01
    • 1970-01-01
    • 2017-10-10
    相关资源
    最近更新 更多