Python 加载Jupyter笔记本扩展时出错

Python 加载Jupyter笔记本扩展时出错,python,jupyter-notebook,jupyter,Python,Jupyter Notebook,Jupyter,我使用的是带有操作系统Sierra的Macbook,运行的是Python 3.6.1和Jupyter笔记本服务器5.0.0 我按照上面提到的说明安装了Jupyter笔记本扩展 虽然笔记本在我的系统上工作正常,但我无法查看nbextensions选项卡。下面是我在terminal中运行jupyter笔记本时看到的错误日志。我在SO上看到了一些相关的问题,但它们似乎与安装特定的扩展有关 此外,解决方案之一似乎是建议pip安装jupyter\u nbextensions\u configurator,

我使用的是带有操作系统Sierra的Macbook,运行的是Python 3.6.1和Jupyter笔记本服务器5.0.0 我按照上面提到的说明安装了Jupyter笔记本扩展

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

此外,解决方案之一似乎是建议
pip安装jupyter\u nbextensions\u 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:没有名为'jupyter\u nbextensions\u 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
[W 08:44:49.973 NotebookApp]不推荐使用服务器\u扩展,请使用nbserver\u扩展
[W 08:44:50.146 NotebookApp]加载服务器扩展jupyter\u nExtensions\u配置程序时出错
回溯(最近一次呼叫最后一次):
文件“/usr/local/lib/python3.6/site packages/notebookapp.py”,第1271行,在init_服务器扩展名中
mod=importlib.import\u模块(modulename)
文件“/usr/local/cillar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/________.py”,第126行,在导入模块中
return _bootstrap._gcd_import(名称[级别:],包,级别)
文件“”,第978行,在_gcd_import中
文件“”,第961行,在“查找”和“加载”中
文件“”,第948行,在“查找”和“加载”中解锁
ModuleNotFoundError:没有名为“jupyter\u nExtensions\u configurator”的模块
[I 08:44:50.158 NotebookApp]从本地目录为笔记本提供服务:/Users/sp
[I 08:44:50.158 NotebookApp]0个活动内核
[I 08:44:50.158 NotebookApp]Jupyter笔记本的运行速度为:http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:50.158 NotebookApp]使用Control-C停止此服务器并关闭所有内核(两次以跳过确认)。
[C 08:44:50.163 NotebookApp]
首次连接时将此URL复制/粘贴到浏览器中,
要使用令牌登录,请执行以下操作:
http://localhost:8888/?token=c777a7ab5dc6cf416c238b7b37f58d10ebea9db0743b46ae
[I 08:44:51.633 NotebookApp]接受来自::1的一次性令牌身份验证连接
[W 08:44:54.407 NotebookApp]404 GET/nbextensions/nbextensions\u configurator/tree\u tab/main.js?v=20170511084449(::1)25.76ms referer=http://localhost:8888/tree

我错过了什么?谢谢

我也有同样的问题,但我注意到在jupyterlab中:

先决条件 Jupyter笔记本电脑版本4.3或更高版本。要检查笔记本版本,请执行以下操作:

jupyter笔记本--版本

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

conda更新笔记本


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

从服务器回溯来看,似乎在多个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路径等。

我刚才也有同样的问题,我通过改变特定环境(例如tensorflow或py36)成功地解决了这个问题,然后输入“jupyter notebook”。它起作用了

我也有同样的问题。下面是我如何解决它的

我已经下载了AnacondaPython版本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使用的和“普通pip”使用的可能不同。

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

注意:它只适用于蟒蛇环境。

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

pip uninstall jupyter
pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator

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

装置 最好从anaconda安装所有软件包:

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


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

最后对我有效的是切换浏览器! 我从Mac上的Safari切换到Chrome,一切都很好!
(Safari 13.0.2版,mac OS High Sierra 10.13.6版,Chrome 83.0.4103.61版)

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

我们中的一些人无法使用Conda。需要一个解决方案来满足所有jupyter笔记本用户的需求。@MyopicVisage我现在在答案中添加了一个注释。谢谢你的建议@近视。。。上述溶胶
conda update notebook
conda install jupyter notebook
conda install -c conda-forge jupyter_nbextensions_configurator
conda install -c conda-forge jupyter_contrib_nbextensions