【问题标题】:Error loading Jupyter Notebook Extensions加载 Jupyter Notebook 扩展时出错
【发布时间】:2017-10-10 12:24:12
【问题描述】:

我正在使用装有 OS Sierra 的 Macbook,并运行 Python 3.6.1 和 Jupyter Notebook Server 5.0.0 我按照https://github.com/ipython-contrib/jupyter_contrib_nbextensions 中提到的说明安装了 Jupyter Notebook 扩展

虽然笔记本在我的系统上运行良好,但我无法查看 nbextensions 选项卡。以下是我在终端中运行jupyter notebook 时看到的错误日志。我在 SO 上看到了一些相关问题,但它们似乎与安装特定扩展有关。

此外,其中一种解决方案似乎是建议pip install jupyter_nbextensions_configurator,但从下面的输出中可以看出,我已经安装了扩展。

Requirement already satisfied: traitlets in /usr/local/lib/python3.6/site-packages (from jupyter_nbextensions_configurator)
Requirement already satisfied: tornado in /usr/local/lib/python3.6/site-packages (from jupyter_nbextensions_configurator)

但是,在日志中,您会注意到 ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator' 是错误消息之一。

[W 08:44:49.973 NotebookApp] server_extensions is deprecated, use nbserver_extensions
[W 08:44:50.146 NotebookApp] Error loading server extension jupyter_nbextensions_configurator
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1271, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 978, in _gcd_import
      File "<frozen importlib._bootstrap>", line 961, in _find_and_load
      File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'jupyter_nbextensions_configurator'
[I 08:44:50.158 NotebookApp] Serving notebooks from local directory: /Users/sp
[I 08:44:50.158 NotebookApp] 0 active kernels
[I 08:44:50.158 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:50.158 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:44:50.163 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:51.633 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[W 08:44:54.407 NotebookApp] 404 GET /nbextensions/nbextensions_configurator/tree_tab/main.js?v=20170511084449 (::1) 25.76ms referer=http://localhost:8888/tree

我在这里缺少什么?谢谢!

【问题讨论】:

    标签: python jupyter-notebook jupyter


    【解决方案1】:

    我遇到了同样的问题。这是我解决它的方法。

    我已经下载了 Anaconda python 3.7 版。我的系统上已经安装了 Python 3.6.7。

    如果我这样做了,我会收到此错误:

    pip install jupyter_contrib_nbextensions
    

    为了解决它,我做了:

    python3.7 -m pip install jupyter_contrib_nbextensions
    

    我没有尝试过,但这也可以解决您的问题:

    conda install -c conda-forge jupyter_nbextensions_configurator
    

    所以我猜这个问题是因为你的系统上有多个版本的 Python。 Anaconda 使用的和“普通点子”使用的可能不同。

    【讨论】:

    • Python 应该默认为环境的 python:python -m pip install jupyter_contrib_nbextensions 应该可以工作。
    【解决方案2】:

    我通过删除 jupyter-notebook、jupyter_contrib_nbextensions 和 jupyter_nbextensions_configurator 并从头开始解决了这个问题。

    注意:它只适用于 Anaconda 环境。

    卸载

    对于不同的安装源,您可以通过以下方式删除这些包:

    pip uninstall jupyter
    pip uninstall jupyter_contrib_nbextensions
    pip uninstall jupyter_nbextensions_configurator
    

    conda remove --force jupyter notebook
    conda remove --force jupyter_nbextensions_configurator
    conda remove --force jupyter_contrib_nbextensions
    

    但我建议您同时运行上述两个命令

    安装

    最好从anaconda安装所有包:

    conda update notebook
    conda install jupyter notebook
    conda install -c conda-forge jupyter_nbextensions_configurator
    conda install -c conda-forge jupyter_contrib_nbextensions
    
    

    【讨论】:

    • 我们中的一些人无法使用 Conda。需要一种解决方案来满足所有 jupyter notebook 用户的需求。
    • @MyopicVisage 我现在在答案中添加了一条注释。感谢您的建议!
    • @MyopicVisage ...上述解决方案实际上并没有使用“Anaconda”,它使用的是开源包conda。为什么你不能使用 conda?您是否处于封闭的 IT 环境中?
    【解决方案3】:

    我遇到了同样的问题,但我在 jupyterlab 的 README 中注意到了这一点:

    先决条件

    Jupyter 笔记本版本 4.3 或更高版本。检查笔记本版本:

    jupyter notebook --version

    因此,尝试使用该命令检查您的版本,如果返回的版本低于 4.3,请尝试更新它:

    conda update notebook

    这就是我解决问题的方法。

    【讨论】:

      【解决方案4】:

      从服务器回溯来看,您似乎在安装多个 python 时可能会遇到一些奇怪的事情。请注意,您正在安装到 python 中

      /usr/local/lib/python3.6
      

      但是您的笔记本服务器回溯从那里开始(notebookapp 似乎正在运行),但跨越(在导入调用中)从安装在的(自制?)Python 运行

      /usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6
      

      一个潜在的骇人听闻的解决方案可能是安装到那个地窖中,然后像以前一样继续,但我建议可能进行更多调查以确定为什么会发生这种情况。相关的可能是您如何启动笔记本服务器、安装模块、运行终端、设置 python 路径等......

      【讨论】:

        【解决方案5】:

        我刚遇到同样的问题,我通过切换到特定环境(例如,tensorflow或py36)成功修复它,然后输入“jupyter notebook”。有效!

        【讨论】:

          【解决方案6】:

          我通过切换到 Anaconda 中的基本环境并安装这些软件包解决了我的问题。 一开始,我在 Anaconda 中创建了一个新环境,因为某些 conda-forge 包无法安装。我在新环境中使用了“pip install”。我安装了这些软件包,但选项卡没有显示。 原因是即使我激活了新环境,jupyter notebook 仍然在基础环境中初始化。这就是为什么 jupyter nootbook 一开始说“找不到模块”的原因。

          【讨论】:

            【解决方案7】:

            我很长一段时间都遇到同样的错误。重新安装 nbconfig、更改设置、给它额外的加载时间、在打开笔记本之前验证安装等都没有帮助。

            最终对我有用的是切换浏览器! 我从 Mac 上的 Safari 切换到 Chrome,一切正常! (Safari 版本 13.0.2,mac OS High Sierra 10.13.6,Chrome 版本 83.0.4103.61)

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2015-11-30
              • 1970-01-01
              • 2021-09-25
              • 2019-03-15
              • 1970-01-01
              • 2021-12-10
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多