如何远程启动IPython笔记本? [英] How to start IPython notebook remotely?

查看:532
本文介绍了如何远程启动IPython笔记本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照这些说明(运行笔记本电脑服务器远程访问IPython笔记本
)I按以下步骤操作:

Following these instructions (Running a notebook server and Remote access to IPython Notebooks ) I proceed as follows:

在远程服务器上:

1)设置NotebookApp.password()

1) Setting NotebookApp.password()

In [1]: from IPython.lib import passwd
In [2]: passwd()    
Enter password:
Verify password:
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

2)创建个人资料

user@remote_host$ ipython profile create 

3)编辑〜/ .ipython / profile_default / ipython_notebook_config.py

# Password to use for web authentication
c = get_config()
c.NotebookApp.password =
u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

4)在端口8889上启动笔记本

4) Start notebook on port 8889

user@remote_host$ ipython notebook --no-browser --port=8889

并且笔记本开始

and the notebook starts


[I 16:08:10.012 NotebookApp]使用MathJax来自CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js

[W 16:08:10.131 NotebookApp]终端不可用(错误是没有名为'terminado'的模块)

[W 16:08:10.131 NotebookApp] Terminals not available (error was No module named 'terminado')

[I 16:08:10.132 NotebookApp]从本地目录提供笔记本:/ cluster / home / user

[I 16:08:10.132 NotebookApp] Serving notebooks from local directory: /cluster/home/user

[I 16:08:10.132 NotebookApp] 0活动内核

[I 16:08:10.132 NotebookApp] 0 active kernels

[I 16:08:10.132 NotebookApp] IPython Notebook运行于: http:// localhost:8889 /

[I 16:08:10.132 NotebookApp] The IPython Notebook is running at: http://localhost:8889/

[I 16:08:10.132 NotebookApp]使用Control-C停止此服务器并关闭所有内核(两次跳过确认)。

[I 16:08:10.132 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

在我的本地计算机上

5)SSH隧道

 user@local$ ssh -N -f -L localhost:8888:127.0.0.1:8889 username@remote_host

On您找到的远程主机( / etc / hosts

On the remote host (/etc/hosts) you find

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

6)最后,我尝试在浏览器上打开 localhost:8888 ,我得到:

6) Finally, I try to open localhost:8888 on my browser, and I get:


频道2:打开失败:连接失败:连接被拒绝

channel 2: open failed: connect failed: Connection refused

频道2:打开失败:连接失败:连接拒绝

channel 2: open failed: connect failed: Connection refused

频道2:开启失败:连接失败:Con拒绝

channel 2: open failed: connect failed: Connection refused

频道2:开启失败:连接失败:连接被拒绝

channel 2: open failed: connect failed: Connection refused

频道2:开启失败:连接失败:拒绝连接

channel 2: open failed: connect failed: Connection refused

所有这些步骤在一台服务器上运行,但在另一台服务器上运行失败。

All these steps work on one server, but fail on another one.

我尝试联系管理员并说出以下内容:

I tried contacting the administrator and said the following:


我认为您正在使用两个单独的SSH连接:一个来自
,您运行ipython,另一个用于端口转发。
无法保证这两个连接将使您登陆
相同的登录节点。如果两个连接在
不同的主机上,您将遇到遇到
的确切失败。因此,您应该在用于运行ipython的
连接中设置端口转发。

I assume that you are using two separate SSH connections: one from which you run ipython and one that you use to do port forwarding. There is no guarantee that the two connections will land you on the same login node. In the case where the two connections are on different hosts, you will experience the exact failure you have encountered. Therefore you should setup the port forwarding in the connection that you use to run ipython.

如何设置端口在我用来运行ipython的连接中转发?

How can I setup the port forwarding in the connection that I use to run ipython?

我尝试使用我的IP地址,但它无法正常工作

I tried using my ip address but it didn't work

$ ssh -N -f -L local_ip_address:8888:127.0.0.1:8889 user@remote_host


推荐答案

最后问题是如何解决的:

Finally this is how the problem was solved:

# Login to the server from your local workstation and in the same connection do the port forwarding.
user@local$ ssh -L 8888:localhost:8889 username@remote_host
user@remote_host$ ipython notebook --no-browser --port=8889

这篇关于如何远程启动IPython笔记本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆