Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kernel Error in R Notebook using Jupyter Notebook

I am trying to use R within the jupyter notebook.

I went to my R shell and ran

install.packages(c('rzmq','repr','IRkernel','IRdisplay'),
             repos = c('http://irkernel.github.io/', getOption('repos')))
IRkernel::installspec()

Then I loaded up my ipython notebook and created a new notebook using the now available R extension. How ever when I access the notebook I run into this kernal error:

Traceback (most recent call last):
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\base\handlers.py", line 394, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\sessions\handlers.py", line 53, in     post
    model = sm.create_session(path=path, kernel_name=kernel_name)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\sessions\sessionmanager.py", line 66, in create_session
    kernel_name=kernel_name)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\html\services\kernels\kernelmanager.py", line 84, in start_kernel
    kernel_name=kernel_name, **kwargs)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\multikernelmanager.py", line 112, in start_kernel
km.start_kernel(**kwargs)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\manager.py", line 240, in start_kernel
**kw)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\manager.py", line 189, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
  File "C:\Users\Nina Kate\Anaconda3\lib\site-packages\IPython\kernel\launcher.py", line 202, in launch_kernel
proc = Popen(cmd, **kwargs)
  File "C:\Users\Nina Kate\Anaconda3\lib\subprocess.py", line 859, in __init__
restore_signals, start_new_session)
  File "C:\Users\Nina Kate\Anaconda3\lib\subprocess.py", line 1112, in _execute_child
startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified
like image 783
r3vdev Avatar asked Aug 04 '15 18:08

r3vdev


People also ask

What is a kernel in Jupyter Notebook?

A kernel is a runtime environment that provides programming language support for the Jupyter Notebook application. When you open a Notebook in edit mode, exactly one interactive session connects to a Jupyter kernel for the Notebook language and Spark version that you select.


2 Answers

I was having exactly the same error in Windows 7. I added R to PATH environment variables and I was able to run it on shell but I was still having the kernel error in Jupyter.

The Kernel started working when installed system wide using:

IRkernel::installspec(user = FALSE)

instead of the first installation option:

IRkernel::installspec()

Note that it is necessary to set both parameters, the PATH variable and the R system wide install.

like image 137
joaquin Avatar answered Sep 28 '22 15:09

joaquin


You probably missed the warning up top about a missing index in the irkernel repo:

Warning: unable to access index for repository http://irkernel.github.io/src/contrib:
   cannot download all files

The new installation steps worked for me (in R 3.3 console):

install.packages('devtools')
devtools::install_github('IRkernel/IRkernel') # IRkernel-master.tar.gz
IRkernel::installspec()  # register kernel in the current R install
IRkernel::installspec(name = 'ir33', displayname = 'R 3.3')  # ir32, R 3.2

When you restart jupyter notebook, an "R 3.3" entry should appear in the list of kernels.

like image 31
hobs Avatar answered Sep 28 '22 14:09

hobs