程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在远程计算机上启动 jupyter 实验室抛出错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决在远程计算机上启动 jupyter 实验室抛出错误?

开发过程中遇到在远程计算机上启动 jupyter 实验室抛出错误的问题如何解决?下面主要结合日常开发的经验,给出你关于在远程计算机上启动 jupyter 实验室抛出错误的解决方法建议,希望对你解决在远程计算机上启动 jupyter 实验室抛出错误有所启发或帮助;

我的 Ubuntu 20.10 个人服务器上安装了 anaconda 版本 4.9.2 和 Jupyter 实验室版本 2.2.9。直到大约两个月前,我才能够在我的远程服务器(通过 MobaXterm 访问)上远程启动 jupyter 实验室。我使用了这个命令: jupyter lab --no-browser --port=40000 --ip=$HOSTname

然后我习惯于将此端口转发到 MobaXterm 中的本地端口 8080,并在我的工作笔记本电脑上打开本地端口。

由于搬家重置了整个设置后,我发现我无法再转发本地端口了。我收到此错误消息:

    Traceback (most recent call last):
  file "/home/kvemuri/anaconda3/bin/jupyter-lab",line 10,in <module>
    sys.exit(main())
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/jupyter_core/application.py",line 254,in launch_instance
    return super(Jupyterapp,cls).launch_instance(argv=argv,**kwargs)
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py",line 844,in launch_instance
    app.initialize(argv)
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py",line 87,in inner
    return method(app,*args,**kwargs)
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py",line 2085,in initialize
    self.init_webapp()
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py",line 1757,in init_webapp
    success = self._bind_http_server()
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py",line 1764,in _bind_http_server
    return self._bind_http_server_unix() if self.sock else self._bind_http_server_tcp()
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py",line 1790,in _bind_http_server_tcp
    self.http_server.Listen(port,self.ip)
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py",line 151,in Listen
    sockets = bind_sockets(port,address=address)
  file "/home/kvemuri/anaconda3/lib/python3.7/site-packages/tornado/netutil.py",line 161,in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 22] InvalID argument

我不太了解端口转发的内部工作原理,我盲目地按照此页面上的说明进行操作:https://wiki.fysik.dtu.dk/gpaw/summerschools/summerschool18/accesswin.html

this question 中的解决方案提供了一些线索,但我不确定如何“将套接字绑定到同一网络上的本地网络接口”,如果这甚至是我需要做的。有什么想法吗?

解决方法

解决了这个问题。解决方案是提供不同的IP: jupyter lab --no-browser --ip=0.0.0.0 --port=40000 然后继续转发端口。我从这里得到了这个想法:https://stackoverflow.com/a/57209107/3258696

我不明白为什么这会起作用,或者为什么 jupyter lab --no-browser --ip=127.0.0.1 --port=40000jupyter lab --no-browser --ip=127.0.1.1 --port=40000 不起作用。

当我执行 cat /etc/hosts 时,我得到:

127.0.0.1 localhost
127.0.1.1 kv_home

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

任何人都可以分解为什么这个错误和修复发生?

大佬总结

以上是大佬教程为你收集整理的在远程计算机上启动 jupyter 实验室抛出错误全部内容,希望文章能够帮你解决在远程计算机上启动 jupyter 实验室抛出错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: