套接字错误-OSError:[Errno 99]-在远程主机上运行Jupyter笔记本

时间:2019-07-24 11:00:40

标签: ssh jupyter-notebook jupyter

我正在使用SSH登录的远程计算机上工作。尝试在名为balancing_selection的虚拟环境中打开jupyter笔记本时,请使用以下命令:

jupyter-notebook --no-browser --port=8887

我收到以下错误:

 Traceback (most recent call last):
      File "/home/homap/miniconda3/envs/balancing_selection/bin/jupyter-notebook", line 11, in <module>
        sys.exit(main())
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
        return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
        app.initialize(argv)
      File "</home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
        return method(app, *args, **kwargs)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/notebook/notebookapp.py", line 1679, in initialize
        self.init_webapp()
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/notebook/notebookapp.py", line 1442, in init_webapp
        self.http_server.listen(port, self.ip)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/tornado/tcpserver.py", line 151, in listen
        sockets = bind_sockets(port, address=address)
      File "/home/homap/miniconda3/envs/balancing_selection/lib/python3.7/site-packages/tornado/netutil.py", line 174, in bind_sockets
        sock.bind(sockaddr)
    OSError: [Errno 99] Cannot assign requested address

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可能需要指定本地主机(VM)的IP地址

jupyter-notebook --no-browser --ip=127.0.0.1 --port=8887

jupyter-notebook --no-browser --ip=0.0.0.0 --port=8887  # all interfaces on host

您的/etc/hosts文件中的localhost设置有可能不正确。 localhost应该指向IPv4地址,并且应该将IPv6创建为IPv6回送的单独条目。

127.0.0.1       localhost.localdomain    localhost
::1             localhost6.localdomain6  localhost6