在Arch

时间:2017-12-28 23:02:22

标签: python jupyter

我正在尝试在Arch上运行Jupyter笔记本。我试过实现jupyter包。我还尝试关注Arch wiki并安装了jupyter-notebookjupyter-nbconvert以及python-ipywidgets。最后,我尝试使用the pip instructions。所有这三个都失败并给出:

➜  ~ jupyter notebook
Traceback (most recent call last):
  File "/usr/sbin/jupyter-notebook", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/usr/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/lib/python3.6/site-packages/notebook/notebookapp.py", line 1368, in initialize
    self.init_webapp()
  File "/usr/lib/python3.6/site-packages/notebook/notebookapp.py", line 1188, in init_webapp
    self.http_server.listen(port, self.ip)
  File "/usr/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen
    sockets = bind_sockets(port, address=address)
  File "/usr/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 22] Invalid argument

与此相关的other reports似乎与sock.bind有不同的错误。我不确定这个问题是否相关。任何关于此事的指导都将受到赞赏。

1 个答案:

答案 0 :(得分:2)

通常使用socket.bind()时,您可以传递主机名或IP。特别是当我们监听本地环回地址时,我们可以传递localhost127.0.0.1(对于ip v4)或::1对于ip v6。

理论中两者都是相同的,但在实践中有许多系统,其中一个(或另一个)是有问题的。它可以是防火墙,防病毒软件将此绑定视为可疑或奇怪的网络配置。虽然你可能仍然应该调查为什么socket.bind()拒绝localhost(在你的情况下),你可以配置jupyter笔记本服务器使用:jupyter notebook --ip=127.0.0.1直接绑定到127.0.0.1,或者更改jupyter笔记本服务器的配置,具有等效的长格式选项c.NotebookApp.ip='127.0.0.1'

此外,如果他在Arch上广泛使用(并通过arch repo安装),我建议联系arch包维护者,以获得一个自定义补丁,将默认值切换为127.0.0.1