IRkernel

Installation

1/3) Installing via CRAN

If you are on linux, go to the Source instructions

You can install all packages using the following lines in an R console:

install.packages('IRkernel')  # Don’t forget step 2/3!

To update the IRkernel package, use update.packages()

1/3) Installing from source

ZMQ

You'll need zmq development headers to compile pbdZMQ (Click your OS):

Ubuntu & Debian
sudo apt-get install libzmq3-dev libcurl4-openssl-dev libssl-dev jupyter-core jupyter-client
Fedora
sudo dnf install czmq-devel libcurl-devel openssl-devel
Arch Linux
sudo pacman -S zeromq curl openssl
Homebrew
xcode-select --install
brew install zmq
# or upgrade
brew update
brew upgrade zmq
MacPorts
  1. make sure an X server is installed, open a terminal and do the following:
    xcode-select --install
    sudo port install zmq
  2. Direct the compiler to use MacPorts libraries using:
    export CPATH=/opt/local/include
    export LIBRARY_PATH=/opt/local/lib

See this bugreport for instruction on how to compile on windows.

R packages

Start R in the same terminal, and proceed as below.

You can install the packages via

install.packages(c('repr', 'IRdisplay', 'IRkernel'), type = 'source')

To update your source installation, repeat above step.

1/3) Development Version
(Only recommended to test a bugfix which is not yet in a stable version)

If you want to compile the latest and greatest (and maybe buggiest…) from git, the easiest way is via the devtools package.

On Ubuntu/Debian, a header package is needed to compile RCurl:

sudo apt-get install libcurl4-openssl-dev

Start a R session and run:

install.packages('devtools')
# We need RCurl for install_github
install.packages('RCurl')
# Install the packages
devtools::install_github(paste0(
    'IRkernel/',
    c('repr', 'IRdisplay', 'IRkernel')
))

To update the git versions, repeat the install_github('IRkernel/...') steps.

2/3) Making the kernel available to Jupyter

If you haven’t done this already, you will have to make Jupyter see the newly installed R kernel by installing a kernel spec.

The kernel spec can be installed for the current user with the following line from R:

IRkernel::installspec()

To install system-wide, set user to False in the installspec command:

IRkernel::installspec(user = FALSE)

3/3) Make useful shortcuts available

If you use Jupyter lab (and you should!), install Ryan Homer’s text-shortcuts extension:

jupyter labextension install @techrah/text-shortcuts

It will make available the familiar shortcuts Ctrl/⌘M to insert %>% and Alt- to insert <-.