ipython 服务器无法启动:没有名为 notebook.notebookapp 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31397421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 09:55:54  来源:igfitidea点击:

ipython server can't launch: No module named notebook.notebookapp

pythonserveripython

提问by LudoC

I've been trying to setup an ipython server following several tutorials (since none was exactly my case). A couple days ago, I did manage to get it to the point where it was launching but then was not able to access it via url. Today it's not launching anymore and I can't find much about this specific error I get:

我一直在尝试按照几个教程设置 ipython 服务器(因为没有一个完全符合我的情况)。几天前,我确实设法让它启动了,但随后无法通过 url 访问它。今天它不再启动,我找不到关于这个特定错误的太多信息:

Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 9, in <module>
    load_entry_point('ipython==4.0.0-dev', 'console_scripts', 'ipython')()
  File "/usr/local/lib/python2.7/dist-packages/ipython-4.0.0_dev-py2.7.egg/IPython/__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 591, in launch_instance
    app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-4.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py", line 302, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ipython-4.0.0_dev-py2.7.egg/IPython/core/application.py", line 386, in initialize
    self.parse_command_line(argv)
  File "/usr/local/lib/python2.7/dist-packages/ipython-4.0.0_dev-py2.7.egg/IPython/terminal/ipapp.py", line 297, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 487, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/traitlets-4.0.0-py2.7.egg/traitlets/config/application.py", line 418, in initialize_subcommand
    subapp = import_item(subapp)
  File "build/bdist.linux-x86_64/egg/ipython_genutils/importstring.py", line 31, in import_item
ImportError: No module named notebook.notebookapp

So about the setup, I have installed the anaconda distrib of ipython, pyzmq & tornado libraries. I have created a profile nbserver and the config file is as follows - ipython.config.py:

关于设置,我已经安装了 ipython、pyzmq 和 Tornado 库的 anaconda distrib。我创建了一个配置文件 nbserver,配置文件如下 - ipython.config.py:

c = get_config()
c.IPKernalApp.pylab = 'inline'
c.NotebookApp.certfile = u'/home/ludo/.ipython/profile_nbserver/mycert.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:e6cb2aa9a[...]'
c.NotebookApp.port = 9999
c.NotebookManager.notebook_dir = u'/var/www/ipynb/'
c.NotebookApp.base_project_url = '/ipynb/'
c.NotebookApp.base_kernel_url = '/ipynb/'
c.NotebookApp.webapp_settings = {'static_url_prefix':'/ipynb/static/'}

I really don't know where to look for clues anymore - and I'm probably lacking a greater understanding of how all this works to figure it out. My ultimate goal is to then use the answer to this questionon SO to complete a setup behind apache and eventually connect it to colaboratory - but seems like it should launch first.

我真的不知道去哪里寻找线索了——我可能对这一切是如何运作的缺乏更深入的了解。我的最终目标是然后使用SO上这个问题的答案来完成 apache 背后的设置并最终将其连接到 colaboratory - 但它似乎应该首先启动。

Many thanks for any help :)

非常感谢您的帮助:)

采纳答案by Andy Smith

This should fix the issue:

这应该可以解决问题:

pip install jupyter

回答by Matt

You should not try to install from github master branch if you do not now what you are doing. Remove what you have installed and stick to stable version.

如果你现在不知道你在做什么,你不应该尝试从 github master 分支安装。删除您已安装的内容并坚持使用稳定版本。

If you want to work on developpement version, ask on the developpement mailing-list. Some knowlege on how to debug this will probably be required.

如果您想使用开发版本,请在开发邮件列表中询问。可能需要一些有关如何调试的知识。

回答by meduz

I received the same problem when upgrading IPython. At the moment the answer was written, it was a bug linked to the latest 4version. If a similar problem occurs for which you wish to switch back to the stable version 3.2.1:

我在升级 IPython 时遇到了同样的问题。在写出答案的那一刻,这是一个链接到最新4版本的错误。如果出现类似问题而您希望切换回稳定版本3.2.1

pip uninstall -y IPython
pip install ipython==3.2.1

回答by LudoC

So to close this thread, and in case it helps anyone, my mistake was to have installed and used the dev version of ipython blindly following a tutorial, thinking I was using the anaconda instance I installed earlier (which was not even in my PATH).

所以要关闭这个线程,以防它对任何人有帮助,我的错误是盲目地按照教程安装和使用了 ipython 的开发版本,以为我正在使用我之前安装的 anaconda 实例(它甚至不在我的 PATH 中) .

Anyhow I:

无论如何我:

  • uninstalled that ipython dev instance
  • added anaconda/bin to my zsh path (add it to ~/.zshrc - that's why it was not even in my path after install) // at this point the server was launching fine but I couldn't access it in my browser >> firewall problems.
  • opened my port of choice in my firewall (help for linodeor ubuntuin general)
  • 卸载了那个 ipython 开发实例
  • 将 anaconda/bin 添加到我的 zsh 路径(将其添加到 ~/.zshrc - 这就是为什么它在安装后甚至不在我的路径中)//此时服务器启动正常,但我无法在浏览器中访问它 > > 防火墙问题。
  • 在我的防火墙中打开我选择的端口(一般对linodeubuntu 的帮助)

And everything works fine now.

现在一切正常。

回答by reubano

Someone mentioned this in a comment, and it (almost) worked for me:

有人在评论中提到了这一点,它(几乎)对我有用:

pip install ipython[notebook]

pipgave an error about the hash not matching. However, what ultimately worked was:

pip给出了关于哈希不匹配的错误。然而,最终奏效的是:

sudo port install py27-notebook

And for py3:

对于 py3:

sudo port install py35-notebook