如何在 IPython (Jupyter) Notebook 中的远程机器上添加内核?
How do I add a kernel on a remote machine in IPython (Jupyter) Notebook?
本地计算机 (PC) UI 右上角的下拉菜单:
Kernel->
Change kernel->
Python 2 (on a local PC)
Python 3 (on a local PC)
My new kernel (on a remote PC)
IPython use kernel 是 ~/.ipython/kernel/<name>
中描述如何启动内核的文件。如果您创建自己的内核(远程或其他),您可以让程序 运行 远程内核并在本地绑定到笔记本所需的端口。
IPython notebook 通过预定义的端口与内核对话。要与远程内核通信,您只需将端口转发到远程机器作为内核初始化的一部分,笔记本不关心内核在哪里,只要它可以与之通信即可。
您可以设置在内核规范文件 (https://ipython.org/ipython-doc/dev/development/kernels.html#kernel-specs) or use a module that can help you set up and manage different kinds of remote kernels: (pip install remote_ikernel
; https://bitbucket.org/tdaff/remote_ikernel) 中调用的包装器脚本。
如果您正在使用 remote_ikernel,并且可以通过 ssh 访问机器,则以下命令将在下拉列表中设置条目:
remote_ikernel manage --add \
--kernel_cmd="ipython kernel -f {connection_file}" \
--name="Remote Python" --interface=ssh \
--host=my_remote_machine
远程 jupyter kernel/kernels 管理实用程序(rk):
https://github.com/korniichuk/rk
-
$ sudo pip install git+git://github.com/korniichuk/rk#egg=rk
Setup SSH for auto login without a password:
$ rk ssh
Install a template of a remote jupyter kernel:
$rk 安装模板
更改kernel.json
文件:
$ sudo gedit /usr/local/share/jupyter/kernels/template/kernel.json
例如从 remote_username@remote_host
到 albert@192.168.0.1
。
本地计算机 (PC) UI 右上角的下拉菜单:
Kernel->
Change kernel->
Python 2 (on a local PC)
Python 3 (on a local PC)
My new kernel (on a remote PC)
IPython use kernel 是 ~/.ipython/kernel/<name>
中描述如何启动内核的文件。如果您创建自己的内核(远程或其他),您可以让程序 运行 远程内核并在本地绑定到笔记本所需的端口。
IPython notebook 通过预定义的端口与内核对话。要与远程内核通信,您只需将端口转发到远程机器作为内核初始化的一部分,笔记本不关心内核在哪里,只要它可以与之通信即可。
您可以设置在内核规范文件 (https://ipython.org/ipython-doc/dev/development/kernels.html#kernel-specs) or use a module that can help you set up and manage different kinds of remote kernels: (pip install remote_ikernel
; https://bitbucket.org/tdaff/remote_ikernel) 中调用的包装器脚本。
如果您正在使用 remote_ikernel,并且可以通过 ssh 访问机器,则以下命令将在下拉列表中设置条目:
remote_ikernel manage --add \
--kernel_cmd="ipython kernel -f {connection_file}" \
--name="Remote Python" --interface=ssh \
--host=my_remote_machine
远程 jupyter kernel/kernels 管理实用程序(rk): https://github.com/korniichuk/rk
-
$ sudo pip install git+git://github.com/korniichuk/rk#egg=rk
Setup SSH for auto login without a password:
$ rk ssh
Install a template of a remote jupyter kernel:
$rk 安装模板
更改
kernel.json
文件:$ sudo gedit /usr/local/share/jupyter/kernels/template/kernel.json
例如从 remote_username@remote_host
到 albert@192.168.0.1
。