将IPython控制台连接到Internet上的内核 [英] Connect IPython Console to an kernel on the internet

查看:117
本文介绍了将IPython控制台连接到Internet上的内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力让这个工作。我已经按照我能找到的在线资料但是没有成功,例如: Ipython Documentation



我正在尝试将本地计算机(笔记本电脑)上的IPython QTConsole连接到互联网上Linode云服务器上运行的IPython内核。



我现在并不担心安全性,只需要简单的方法就可以了。



我知道我可以在遥控器上启动内核( Linode服务器)使用somethign如:

  Ipython kernel --ip = 0.0.0.0 

一旦我运行这个,我可以记下kernel-xxxx.json文件,我也知道要在远程机器上找到它。使用0.0.0.0表示法我理解内核将监听外部连接。



我只是不确定如何从我的本地计算机(笔记本电脑)连接到它/ p>

让我们说

 远程机器IP地址= aa.bb.cc .dd 
远程计算机登录名= root
远程计算机主机名= dummyname

本地机器(笔记本电脑)

  IPAdress = qq.ww.ee.rr 

我可以正常看到服务器和ssh,例如

  ssh root@aa.bb.cc.dd 

任何人都可以帮助我从我的笔记本电脑连接到这个远程内核的ipython命令行?

解决方案

首先你必须知道IP服务器的地址(posix上的 ifconfig 和Windows上的 ipconfig )。假设IP地址是 10.10.10.10



然后你可以在服务器上启动内核: / p>

  ipython kernel --ip = * --IPKernelApp.connection_file = / tmp / kernel.json 

启动内核后,获取 /tmp/kernel.json

  $ cat /tmp/kernel.json 
{
stdin_port:59836,
ip:*,
hb_port:50806,
key:11c2f53e-ad38-4d1d-b038-2f4bd04c4d49,
shell_port:49904,
iopub_port:55081
}

在您的客户端上创建一个 /path/to/your/kernel.json 具有相同内容的文件,除了ip地址是真实的ip地址,而不是 *

  {
stdin_port:59836,
ip: 10.10.10.10,
hb_port:50806,
key:11c2f53e-ad38-4d1d-b038-2f4bd04c4d49,
shell_port:49904,
iopub_port:55 081
}

之后你就可以开始 qtconsole with:

  ipython qtconsole --existing /path/to/your/kernel.json 

您可以根据需要连接多个 qtconsoles 内核。



注意:请勿调用 exit()函数退出 qtconsole ,这将停止你的内核。只需点击关闭窗口按钮。


I have been struggling to get this working. I have followed the online stuff I could find but have been unsuccessful e.g: Ipython Documentation

I am trying to connect an IPython QTConsole on my local machine (laptop) to an IPython kernel running on a Linode cloud server on the internet.

I am not worried about security for now and just need the simplist way to do this.

I know I can start a kernel on the remote (Linode server ) using somethign like:

Ipython kernel --ip=0.0.0.0

Once i run this I can note down the kernel-xxxx.json file and I also know were to find it on the remote machine. Using the 0.0.0.0 notation I understand that the kernel will listen for outside connections.

I am just not sure how to connect to it from my local machine (Laptop)

Lets say

Remote machine  IP adres = aa.bb.cc.dd
Remote machine  Login name = root
Remote machine  hostname = dummyname

Local machine (Laptop)

 IPAdress = qq.ww.ee.rr

I can see the server and ssh to it normally e.g.

ssh root@aa.bb.cc.dd

Can anybody please help me with the ipython command line to connect to this remote kernel from my laptop?

解决方案

First you have to know the IP address of your server (ifconfig on posix and ipconfig on windows). Lets say the IP address is 10.10.10.10.

Then you can start the kernel on your server with:

ipython kernel --ip=* --IPKernelApp.connection_file=/tmp/kernel.json

When the kernel is started, get the content of the /tmp/kernel.json

$ cat /tmp/kernel.json
{
  "stdin_port": 59836,
  "ip": "*",
  "hb_port": 50806,
  "key": "11c2f53e-ad38-4d1d-b038-2f4bd04c4d49",
  "shell_port": 49904,
  "iopub_port": 55081
}

On your client create a /path/to/your/kernel.json file that has the same content, except that the ip address is the real ip address, and not the *:

{
  "stdin_port": 59836,
  "ip": "10.10.10.10",
  "hb_port": 50806,
  "key": "11c2f53e-ad38-4d1d-b038-2f4bd04c4d49",
  "shell_port": 49904,
  "iopub_port": 55081
}

After that you can start your qtconsole with:

ipython qtconsole --existing /path/to/your/kernel.json

You can connect as many qtconsoles as you want to the same kernel.

Note: Don't call the exit() function to exit your qtconsole, that will stop your kernel. Just click the close window button.

这篇关于将IPython控制台连接到Internet上的内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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