问题描述
我正试图在jupyter笔记本中使用R。
I am trying to use R within the jupyter notebook.
我去了我的R shell跑了
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
推荐答案
我在Windows 7中遇到了完全相同的错误。
我将R添加到PATH环境变量我能够在shell上运行它,但我仍然在Jupyter中遇到内核错误。
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()
请注意,必须设置两个参数,PATH变量和R系统范围的安装。
Note that it is necessary to set both parameters, the PATH variable and the R system wide install.
这篇关于使用Jupyter Notebook的R笔记本中的内核错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!