IElixir and Jupyter Lab

Saturday, February 8, 2020

I really enjoy working in Jupyter Lab for taking markdown notes as I am reading or throwing together short little code snippets as I am learning something new. As such when I am learning a new language, such as Elixir I often want to reach out for a similar tool. A few months ago I came across this article and now I've finally set up a working IElixir kernel to use.

What this gets me is an environment where I can write snippets of Elixir code, just like I would for prototyping with Python. That said, the setup I will be writing about here is very simplistic. I'm sure many others have taken Python set ups in Jupyter lab much farther than I have. In any case this post will share the few steps you need to get IElixir running and connected to Jupyter lab. If you haven't installed jupyter lab that should be as simple as doing:

$ pip install --user jupyterlab

The first step will be getting IElixir installed, the official instructions can be found here. This of course assumes you have Elixir installed on your system. Another dependency that I needed to install for IElixir was zeromq-devel which you can get in your package manager or follow here. Once you've got IElixir and Jupyterlab installed, there are two steps left:

Start up the IElixir kernel process and leave that running:

$ ~/.local/bin/jupyter kernel --kernel=ielixir
[KernelApp] Starting kernel 'ielixir' [KernelApp] Connection file:
/home/wgwz/.local/share/jupyter/runtime/kernel-39b05ef7-4c4f-4b23-8b71-21d1306ef9d6.json
[KernelApp] To connect a client: --existing
kernel-39b05ef7-4c4f-4b23-8b71-21d1306ef9d6.json

Start up jupyter lab as usual:

$ jupyter lab

Then when you open up the launcher window in Jupyter lab you we will see an option for Elixir. You'll be able to open up a terminal or a notebook, just the same as you would with Python. And profit!