IRkernel Difficulties

Suddenly, when starting up ipython/Jupyter notebook, the R kernel won’t load. I’m getting the following error:

[W 10:21:13.833 NotebookApp] Notebook Code/notebooks/Syuzhet_of_Small_Stories.ipynb is not trusted
[W 10:21:13.887 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20160521102047 (::1) 11.86ms referer=http://localhost:8888/notebooks/Code/notebooks/Syuzhet_of_Small_Stories.ipynb
[I 10:21:14.266 NotebookApp] 302 GET /notebooks/Code/images/R-dendrogram.png (::1) 1.95ms
[I 10:21:14.476 NotebookApp] Kernel started: f2fee2d4-fdc2-4bd7-8cc5-8cd628894807
Error in loadNamespace(name) : there is no package called ‘IRkernel’
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted

Let’s work through these difficulties one line at a time:

Notebook Code/notebooks/Syuzhet_of_Small_Stories.ipynb is not trusted

The documentation for iPython notebook states:

Sometimes re-executing a notebook to generate trusted output is not an option, either because dependencies are unavailable, or it would take a long time. Users can explicitly trust a notebook in two ways:

At the command-line, with:

ipython trust /path/to/notebook.ipynb

After loading the untrusted notebook, with File / Trust Notebook

After running that, I still get the following:

Screen Shot 2016-05-21 at 10.38.34 AM

The next fail appoint appears to be:

Error in loadNamespace(name) : there is no package called ‘IRkernel’

What the what the?

I’ve been running R in iPython notebook for the past week. What happened to the IRkernel package? When I run R and simply try to re-install it:

Warning message:
package ‘IRkernel’ is not available (for R version 3.3.0) 

Ack. At some point MacPorts updated R when I wasn’t paying attention, which is the problem with package managers and it’s really my responsibility. So let’s see if I can un-install 3.3.0 and if that clears things up … too complicated.

BUT there is a solution and it can be done from within R (3.3.0):

install.packages(c('pbdZMQ', 'repr', 'devtools'))  # repr is already on CRAN
IRkernel::installspec()  # to register the kernel in the current R installation

4 simple steps and everything is hunky-dory (why one would want a muscular skiff, I don’t know).

Leave a Reply