加载 Jupyter Notebook 扩展错误

2024-05-19 12:35:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的Macbook带有OS Sierra,运行Python3.6.1和Jupyter Notebook Server 5.0.0 我按照https://github.com/ipython-contrib/jupyter_contrib_nbextensions中提到的说明安装了Jupyter笔记本扩展

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

此外,其中一个解决方案似乎是suggestpip 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

我错过了什么?谢谢!


Tags: infromimportserverlibusrlocalline
3条回答

我也有同样的问题,但我在朱庇特实验室的README里注意到:

Prerequisites

Jupyter notebook version 4.3 or later. To check the notebook version:

jupyter notebook --version

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

conda update notebook

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

我也有同样的问题。我就是这样解决的。

我已经下载了Python3.7版。我的系统中已经有了Python3.6.7。

如果我这样做,我会得到这个错误:

pip install jupyter_contrib_nbextensions

为了解决这个问题,我做到了:

python3.7 -m pip install jupyter_contrib_nbextensions

我没有试过,但这也能解决你的问题:

conda install -c conda-forge jupyter_nbextensions_configurator

所以我猜问题是因为你的系统中有多个版本的Python。水蟒使用的那个和“正常琵琶”使用的那个可能是不同的。

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

卸载

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

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

相关问题 更多 >