All Projects → korniichuk → rk

korniichuk / rk

Licence: Unlicense license
The remote Jupyter kernel/kernels administration utility

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to rk

Best Of Jupyter
🏆 A ranked list of awesome Jupyter Notebook, Hub and Lab projects (extensions, kernels, tools). Updated weekly.
Stars: ✭ 200 (+277.36%)
Mutual labels:  jupyter-kernels, jupyterhub, jupyterlab
Ansible Jupyterhub
Ansible role to setup jupyterhub server (deprecated)
Stars: ✭ 14 (-73.58%)
Mutual labels:  ipython, ipython-notebook, jupyterhub
Awesome Jupyter
A curated list of awesome Jupyter projects, libraries and resources
Stars: ✭ 2,523 (+4660.38%)
Mutual labels:  ipython, jupyterhub, jupyterlab
notebook-free-notebook
A professional, lock-in-free Jupyter dev env for coders, teams and non-trivial, large Jupyter projects
Stars: ✭ 38 (-28.3%)
Mutual labels:  ipython, jupyterlab, jupyter-notebooks
Sqlcell
SQLCell is a magic function for the Jupyter Notebook that executes raw, parallel, parameterized SQL queries with the ability to accept Python values as parameters and assign output data to Python variables while concurrently running Python code. And *much* more.
Stars: ✭ 145 (+173.58%)
Mutual labels:  ipython, ipython-notebook, jupyterlab
math-server-docker
The ideal multi-user Data Science server with Jupyterhub and RStudio, ready for Python, R and Julia languages.
Stars: ✭ 70 (+32.08%)
Mutual labels:  jupyter-kernels, jupyterhub, jupyterlab
Jupyterhub Deploy Teaching
Reference deployment of JupyterHub and nbgrader on a single server
Stars: ✭ 194 (+266.04%)
Mutual labels:  ipython, jupyterhub
Nbstripout
strip output from Jupyter and IPython notebooks
Stars: ✭ 738 (+1292.45%)
Mutual labels:  ipython, ipython-notebook
Jupyterlab Lsp
Coding assistance for JupyterLab (code navigation + hover suggestions + linters + autocompletion + rename) using Language Server Protocol
Stars: ✭ 796 (+1401.89%)
Mutual labels:  ipython, jupyterlab
05 Python Files
Python too supports file handling and allows users to handle files i.e., to read and write files, along with many other file handling options, to operate on files. The concept of file handling has stretched over various other languages, but the implementation is either complicated or lengthy, but like other concepts of Python, this concept here …
Stars: ✭ 163 (+207.55%)
Mutual labels:  ipython, ipython-notebook
Ipytracer
📊 Algorithm Visualizer for IPython/Jupyter Notebook
Stars: ✭ 138 (+160.38%)
Mutual labels:  ipython, ipython-notebook
Juniper
🍇 Edit and execute code snippets in the browser using Jupyter kernels
Stars: ✭ 189 (+256.6%)
Mutual labels:  ipython, jupyterlab
Tutorials
CatBoost tutorials repository
Stars: ✭ 563 (+962.26%)
Mutual labels:  ipython, ipython-notebook
Hydrogen
Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
Stars: ✭ 3,763 (+7000%)
Mutual labels:  ipython, jupyter-kernels
Jupyterhub
Multi-user server for Jupyter notebooks
Stars: ✭ 6,488 (+12141.51%)
Mutual labels:  ipython, jupyterhub
Vscodejupyter
Jupyter for Visual Studio Code
Stars: ✭ 337 (+535.85%)
Mutual labels:  ipython, ipython-notebook
Show ast
An IPython notebook plugin for visualizing ASTs.
Stars: ✭ 76 (+43.4%)
Mutual labels:  ipython, ipython-notebook
Sci Pype
A Machine Learning API with native redis caching and export + import using S3. Analyze entire datasets using an API for building, training, testing, analyzing, extracting, importing, and archiving. This repository can run from a docker container or from the repository.
Stars: ✭ 90 (+69.81%)
Mutual labels:  ipython, ipython-notebook
imongo
A MongoDB kernel for Jupyter
Stars: ✭ 51 (-3.77%)
Mutual labels:  ipython, jupyter-kernels
Telepyth
Telegram notification with IPython magics.
Stars: ✭ 54 (+1.89%)
Mutual labels:  ipython, ipython-notebook

Installation

Install the rk from PyPI

$ sudo pip install rk

Install the rk from GitHub

$ sudo pip install git+git://github.com/korniichuk/rk#egg=rk

Upgrade the rk from PyPI

$ sudo pip install -U rk

or:

$ sudo pip install --upgrade rk

Important

The rk set to dafault the kernels dict kernels.json. Save the current kernels dict to home dir before upgrade, and replace default kernels dict file after.

Uninstall the rk

$ sudo pip uninstall rk

Development installation

$ git clone git://github.com/korniichuk/rk.git
$ cd rk
$ sudo pip install .

Quickstart

quickstart [youtube video]

First, make sure that you can login to a remote machine without entering password. The most basic form of the command is:

$ ssh REMOTE_HOST

If your username is different on a remote machine, you can specify it by using this syntax:

$ ssh REMOTE_USERNAME@REMOTE_HOST

Example:

$ ssh [email protected]

Note

You can setup SSH for auto login without a password like this: $ rk ssh.

Second, install a template of a remote jupyter kernel to kernels location:

$ rk install-template

Third, change the kernel.json file:

$ sudo gedit /usr/local/share/jupyter/kernels/template/kernel.json

The kernel.json file looks like this:

{
 "argv": [
  "rkscript",
  "python",
  "{connection_file}",
  "remote_username@remote_host"
 ],
 "display_name": "Template",
 "language": "python"
}

For a python2 remote jupyter kernel just change remote_username@remote_host. For example from remote_username@remote_host to [email protected].

Fourth, launch jupyter notebook and check your new remote juputer kernel:

$ jupyter notebook

or:

$ ipython notebook

Choose: Files -> New -> Template.

User guide

Help

The standard output for –help:

$ rk -h

or:

$ rk --help

For information on using subcommand "SUBCOMMAND", do:

$ rk SUBCOMMAND -h

or:

$ rk SUBCOMMAND --help

Example:

$ rk install -h

Version

The standard output for –version:

$ rk -v

or:

$ rk --version

Kernels dict

user guide: kernels dict [youtube video]

Open kernels.json file:

$ sudo gedit /usr/local/lib/python2.7/dist-packages/rk/config/kernels.json

The kernels.json file looks like this:

{
 "template": {
  "display_name": "Template",
  "interpreter": "python",
  "language": "python",
  "remote_host": "remote_username@remote_host"
 }
}

Where:

  • template -- the name of a remote jupyter kernel,
    • display_name -- a kernel’s name as it should be displayed in the UI. Unlike the kernel name used in the API, this can contain arbitrary unicode characters [1],
    • interpreter -- an entry point or an absolute path to language interpreter on a remote machine,
    • language -- a name of the language of a kernel. When loading notebooks, if no matching kernelspec key (may differ across machines) is found, a kernel with a matching language will be used. This allows a notebook written on any python or julia kernel to be properly associated with the user's python or julia kernel, even if they aren’t listed under the same name as the author’s [1],
    • remote_host -- just a remote host or, if your username is different on a remote machine, use this syntax: remote username AT remote host.

Note

For checking absolute path to language interpreter on a remote machine use a which Unix command. For example, for the python3 language on a remote machine: $ which python3.

Change kernels.json file and add info about your remote jupyter kernels, for example like this:

{
 "albert2": {
  "display_name": "Albert Python 2",
  "interpreter": "python2",
  "language": "python",
  "remote_host": "[email protected]"
 },
 "albert3": {
  "display_name": "Albert Python 3",
  "interpreter": "python3",
  "language": "python",
  "remote_host": "[email protected]"
 }
}

Where:

  • albert2, albert3 -- the names of a remote jupyter kernels,
    • Albert Python 2, Albert Python 3 -- the display names for the UI,
    • python2, python3 -- entry points on a remote machine,
    • python -- the name of the language of a remote jupyter kernel,
    • albert -- the remote username on a remote machine, not similar with a username on a local machine,
    • 192.168.0.1 -- the remote host.

Kernels location

Jupyter support the system and the user kernels locations:

  kernels location
system /usr/local/share/jupyter/kernels; /usr/share/jupyter/kernels
user ~/.ipython/kernels

The default kernels location in the rk: /usr/local/share/jupyter/kernels.

Change the default kernels location:

$ sudo gedit /usr/local/lib/python2.7/dist-packages/rk/config/rk.ini

Important

The user kernels location takes priority over the system kernels locations.

Show list of remote jupyter kernels from kernels dict

$ rk list

Install a remote jupyter kernel/kernels from kernels dict to kernels location

$ rk install KERNEL_NAME [KERNEL_NAME ...]

Where:

  • KERNEL_NAME -- a name of a remote jupyter kernel in the kernels dict kernels.json.

Example:

$ rk install albert2
$ rk install albert2 albert3

Install a template of a remote jupyter kernel to kernels location

$ rk install-template

Important

After this subcommand open the kernel.json file and change values of dict: $ sudo gedit /usr/local/share/jupyter/kernels/template/kernel.json.

Install all remote jupyter kernels from kernels dict to kernels location

$ rk install-all

Uninstall a remote jupyter kernel/kernels from kernels location

$ rk uninstall KERNEL_NAME [KERNEL_NAME ...]

Where:

  • KERNEL_NAME -- a name of installed remote jupyter kernel.

Example:

$ rk uninstall albert2
$ rk uninstall albert2 albert3

Uninstall a template of a remote jupyter kernel from kernels location

$ rk uninstall-template

Uninstall all jupyter kernels from kernels location

$ rk uninstall-all

Setup SSH for auto login without a password

$ rk ssh

If you are familiar with ssh-keygen, ssh-copy-id and ssh-add, this code also setup SSH for auto login without a password [2]:

$ ssh-keygen -t rsa -b 4096 -N '' -f ~/.ssh/id_rsa
$ ssh-copy-id REMOTE_HOST
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa

Note

If your username is different on a remote machine, you can specify it by using this syntax: $ ssh-copy-id REMOTE_USERNAME@REMOTE_HOST.

Log files

The default log files location in the rk: /tmp/rk/log. The name of rk log file, for working remote jupyter kernel, look like this: [email protected]_1879-03-14_11.30.00.txt. And the log file looks like this:

date: 1879-03-14 Friday
time: 11:30:00

usernames: bree<->albert
remote host: 192.168.0.1

stdin ports: 37654<->58933
hb ports: 53538<->59782
iopub ports: 45330<->51989
shell ports: 36523<->36107
control ports: 50090<->53633

pids: 16965<->20944

Note

Change the default log files location: $ sudo gedit /usr/local/lib/python2.7/dist-packages/rk/config/rk.ini.

The paramiko log file is available in a local connection file directory. The name of paramiko log file, for working remote jupyter kernel, look like this: paramiko-843664c7-798d-4a9e-979c-22d0dc4a6bd5.txt.

History

Legend

  • added
  • corrected
  • removed

rk 0.3

  • bug in the rk and in the rkscript: an initial component of ~ or ~user is not replaced in a paths.
  • bug in the rk: a superuser (root) privileges required for the user kernels location ~/.ipython/kernels.
  • setup SSH for auto login without a password with a "ssh" subcommand.
  • error in the rkscript: list index out of range.
  • info about working remote jupyter kernel in rk log file.
  • paramiko log file in a local connection file dir.
  • error in the rkscript: no handlers could be found for logger "paramiko.transport".
  • local port forwarding in the rkscript via paramiko, not via pexpect.

rk 0.2

  • uninstall all jupyter kernels from kernels location with a "uninstall-all" subcommand.
  • uninstall a remote jupyter kernel/kernels from kernels location with a "uninstall" subcommand.
  • install a remote jupyter kernel/kernels from kernels dict to kernels location with a "install" subcommand.
  • install all remote jupyter kernels from kernels dict to kernels location with a "install-all" subcommand.
  • show list of remote jupyter kernels from kernels dict with a "list" subcommand.

Footnotes

[1](1, 2) http://ipython.org/ipython-doc/dev/development/kernels.html#kernel-specs
[2]https://help.github.com/articles/generating-ssh-keys/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].