在远程主机上运行Jupyter笔记本

在远程主机上运行Jupyter笔记本

本文介绍了套接字错误-OSError:[Errno 99]-在远程主机上运行Jupyter笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm working on a remote machine using SSH login. When trying to open the jupyter notebook in the virtual environment called balancing_selection, using the following command:

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

我该如何解决这个问题?

How could I solve this issue?

推荐答案

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

You may need to specify the IP of your localhost (VM)

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回送的单独条目.

It's also possible that your /etc/hosts file has localhost set incorrectly. The localhost should be pointed to the IPv4 address, and IPv6 should be created as a separate entry for the IPv6 loopback.

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

这篇关于套接字错误-OSError:[Errno 99]-在远程主机上运行Jupyter笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 01:48