Skip to main content

Python Script to connect to remote IPyKernel via ssh

Project description

Remote Kernel v1.1

Remote kernel is a pure-python package that sets up an ssh connection with port forwarding to a remote host, and starts up an IPyKernel on that host. This allows a locally running instance of Jupyter or Spyder to easily run code on a remote server. Moreover, this can be installed as a jupyter 'kernel', allowing you to use this just as easily as you would use a local kernel!

Installation

To install remote_kernel, run:

pip install remote-kernel

Usage

Remote kernel is intended to spawn kernels on remote servers for use in both Jupyter notebooks and Spyder.

Jupyter

Install the remote kernel:

python -m remote_kernel install -t <ssh_host> [Options]

To obtain a list of options for the installation, run:

python -m remote_kernel install --help

Spyder

To use the remote kernel in spyder, a kernel needs to be manually started and then connected to from spyder.

To start the remote kernel:

python -m remote_kernel -t <ssh_host> [Options]

Again, options can be listed using:

python -m remote_kernel --help

Alternatively, it is possible to start the remote kernel from a kernel spec file (i.e. what jupyter uses to start kernels):

python -m remote_kernel from-spec <kernel-name>

Here, <kernel-name> is the name of directory containing the kernel.json kernel spec file. If the name is relative, remote_kernel looks for it relative to the current directory, as well as in the jupyter kernel directories, where jupyter kernels are installed as directories with the kernel name.

If successfull, this will print a message like this:

remote_kernel.start I: Remote Kernel started. To connect another client to this kernel, use:
    --existing kernel-<user>@<host>.json

Copy this name (or just the <user>@<host part) and use it to connect to a local existing kernel in spyder. Even though the kernel is running remotely, and we're using SSH, connect to it as if it were running locally (i.e. don't check the SSH box). N.B. The convenience function with the id expansion also works using the <user>@<host> part, even though it's not a number.

N.B. By default, remote_kernel starts regular ipykernels on the remote server, but this can be overridden using the -c command line option.

Acknowledgements/Requirements

This package relies heaviliy on the following packages

  • paramiko, for setting up the ssh connection.
  • sshtunnel, for creating the forwarding tunnels for the kernel ports.

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

remote_kernel-1.1.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

remote_kernel-1.1-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file remote_kernel-1.1.tar.gz.

File metadata

  • Download URL: remote_kernel-1.1.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.5.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.3

File hashes

Hashes for remote_kernel-1.1.tar.gz
Algorithm Hash digest
SHA256 a8e2492b9e641b6f19bacb90940e93cb41b087526648625e3ddd0145bcd304a7
MD5 f415dc9e1e1ac8b2095d0f87f56efa45
BLAKE2b-256 6cb4050613db251f3ff13b2fb108057110ed921c362a405c1853d0748ddb16b8

See more details on using hashes here.

File details

Details for the file remote_kernel-1.1-py3-none-any.whl.

File metadata

  • Download URL: remote_kernel-1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.5.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.3

File hashes

Hashes for remote_kernel-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 96940b2a2e524edb753ea91a7f7dbf405807da33f716053ad4d6e4456cda46da
MD5 94f84293bc9b6f5ca5d182b2ec72a85f
BLAKE2b-256 2030b2dd2d4414dad9feb289dcc866f3aedcd5f083d15063c19209af57a9c69f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page