Installing RKernel

拈花ヽ惹草 提交于 2019-11-28 12:17:42

问题


Despite all my efforts, I wasn't able to install the R kernel for my IPython/Jupyter notebook on Canopy.

I've closely followed the clear instructions given in: http://www.michaelpacer.com/maths/r-kernel-for-ipython-notebook (or, alternatively, http://irkernel.github.io/installation/)

All goes well until the last step that install the kernel on Jupyter:

IRkernel::installspec()

Here is the weird message I get:

File "/Users/julien/Library/Enthought/Canopy_64bit/User/bin/jupyter-kernelspec", line 8
from jupyter_client.kernelspecapp import KernelSpecApp.launch_instance
                                                      ^
SyntaxError: invalid syntax

My configuration is the following:

  • Macbook with El Capitan
  • R version 3.2.2
  • IPython 4.0.1
  • Jupyter 4.0.6

回答1:


It turns out that the file "jupyter-kernelspec " was corrupted for some reason. I replaced it by the following code:

#!/usr/bin/env python
from jupyter_client.kernelspecapp import KernelSpecApp
def main():
    KernelSpecApp.launch_instance()
if __name__ == '__main__':
    main()

It solved my issue.

Julien



来源:https://stackoverflow.com/questions/35420680/installing-rkernel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!