Installing RKernel

2019-01-29 12:30发布

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条回答
时光不老,我们不散
2楼-- · 2019-01-29 13:07

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

查看更多
登录 后发表回答