Jupyter Lab Ruby Kernel Install
Updated: 2019-10-04
Published: 2019-01-28
Intro
Jupyter Lab is the next-generation web-based user interface for Jupyter project. I first encountered The Jupyter project back when it was know as IPython notebooks and used it for hacking on python projects.
I was pleasantly surprised to learn that the Jupyter project also supports kernels other than Python with Ruby being one of them. This post covers installing the iRuby kernel for use with Jupyter Notebooks.
This post assumes that rbenv and ruby 2.6.0 is already installed. You can follow post to get them installed.
For reference the following software will be used in this post.
- Python - 3.6.7
- Jupyter Lab - 4.4.0
- rbenv - 1.1.1-39-g59785f6
- Ruby - 2.6.0
- iRuby - 0.3
Dependencies
Install the required dependencies.
sudo apt install libzmq3-dev libczmq-devJupyter Lab Install
Create a virtual environment and Install Jupyter Lab.
mkdir -p /home/bradmin/Documents/code/python/jupyter-lab
cd /home/bradmin/Documents/code/python/jupyter-lab
source .venv/bin/activate
pip install jupyterlabInstall iRuby
Create a ruby environment and install iRuby and its dependencies.
mkdir -p /home/bradmin/Documents/code/python/jupyter-lab/ruby
cd /home/bradmin/Documents/code/python/jupyter-lab/ruby
rbenv local 2.6.0
gem install bundler cztop irubyNow register the Ruby kernel with Jupyter Lab.
iruby register --forceTesting Testing 123..
Start Jupyter lab.
jupyter-labYour browser will open, select the Ruby Kernel notebook.

Outro
Ruby does not have a nice interactive terminal, it has IRB which is very bare bones and does not have a great user experience. Using Jupyter Lab with a Ruby kernel is a nice way to hack on a Ruby project with a user friendly interface.
Update: Ruby does have pry which is very nice alternative to IRB.
Links
https://jupyterlab.readthedocs.io/en/stable/
https://github.com/jupyter/jupyter/wiki/Jupyter-kernels