[英]Installing R kernel for Ipython on Windows
I am on Windows 10. I have installed R-3.2.0, Anaconda 2.2.0 64 bit, RStudio-0.99.446.我使用的是 Windows 10。我已经安装了 R-3.2.0、Anaconda 2.2.0 64 位、RStudio-0.99.446。 Also, edited system path variable to include R installation directory.此外,编辑系统路径变量以包含 R 安装目录。
I am following all the instruction given in https://github.com/IRkernel/IRkernel but I am not getting R kernel when I open Ipython notebook.我正在遵循https://github.com/IRkernel/IRkernel 中给出的所有说明,但是当我打开 Ipython notebook 时我没有得到 R 内核。
Can anybody tell what am I missing?谁能告诉我我错过了什么?
Got it working, after following all the process mentioned in IRkernel GitHub page. 按照IRkernel GitHub页面中提到的所有过程完成后工作。 Create kernel.json file in C:\\Users\\[username]\\.ipython\\kernels\\R_kernel, content of the file should be 在C:\\ Users \\ [用户名] \\ .ippython \\ kernels \\ R_kernel中创建kernel.json文件,该文件的内容应该是
{"argv": ["C:/Program Files/R/R-3.2.0/bin/R.exe","-e","IRkernel::main()",
"--args","{connection_file}"],
"display_name":"R"
}
Note that instead of forward slash path should contain backward slash as mentioned above. 请注意,如上所述,而不是正斜杠路径应包含反斜杠。
Once IRkernel
is installed, you can also simply issue the following command in R: 安装IRkernel
,您还可以在R中发出以下命令:
IRkernel::installspec(user = FALSE)
The kernel.json
file should be automatically created in the appropriate folder ("C:\\ProgramData\\jupyter\\kernels\\ir"), along with a nice R logo 应该在相应的文件夹(“C:\\ ProgramData \\ jupyter \\ kernels \\ ir”)中自动创建kernel.json
文件,以及一个漂亮的R徽标
Those who haven't installed it yet can follow these instructions:那些还没有安装它的人可以按照以下说明进行操作:
Visit this LinkedIn post if you want to read the instructions in spanish.如果您想阅读西班牙语说明,请访问此LinkedIn 帖子。
1) Create your R virtual enviroment 1) 创建你的 R 虚拟环境
Skip this step if you have it already.如果您已经拥有,请跳过此步骤。 If you don't know how to create it, visit this page .如果您不知道如何创建它,请访问此页面。
2) Get your R executable path 2) 获取你的 R 可执行路径
This step is to make sure you to use the proper instalation of R through the next steps and with that, avoid reference/path errors later.这一步是为了确保您在接下来的步骤中使用正确的 R 安装,并避免以后出现引用/路径错误。 There are several ways to get the path, the one I propose is the following:获取路径的方法有多种,我建议的方法如下:
2.1 Run Anaconda prompt as administrator. 2.1 以管理员身份运行 Anaconda prompt。 If you don't know how to do it visit this page .如果您不知道如何操作,请访问此页面。
2.2 In Anaconda Prompt, active your R virtual enviroment using the command activate {my enviroment's name}
(notice that, in my case, I named my R virtual enviroment as 'RStudio'): 2.2 在 Anaconda Prompt 中,使用命令activate {my enviroment's name}
你的 R 虚拟环境(注意,在我的例子中,我将我的 R 虚拟环境命名为“RStudio”):
R.home()
In my case:就我而言:
3) Quit R session, and then, deactivate your virtual enviroment 3)退出R会话,然后停用您的虚拟环境
You can use the method q()
to quit R. For deactivating your virtual enviroment use the command: conda deactivate
您可以使用q()
方法退出 R。要停用您的虚拟环境,请使用命令: conda deactivate
4) Run R from your base enviroment 4) 从你的基本环境运行 R
Go to the path you copied in Step 2 .转到您在步骤 2 中复制的路径。 For that, use the command:为此,请使用以下命令:
cd {your path here}
Once there, type R.exe and press Enter.在那里,键入 R.exe 并按 Enter。
eg例如
If you got no errors here, go to Step 5 .如果这里没有错误,请转到步骤 5 。
If you got a dynamic link library error like this when trying to run R.exe:如果在尝试运行 R.exe 时遇到这样的动态链接库错误:
Use the following command:使用以下命令:
conda install -c r r
Once solved, run R.exe again and then, continue to Step 5解决后,再次运行R.exe,然后继续步骤5
5) Installing R kernel stuff 5)安装R内核的东西
Now, you're in Anaconda Prompt as Administrator, with your R session opened from the base enviroment, the next you must do is:现在,您以管理员身份在 Anaconda Prompt 中,从基本环境打开您的 R 会话,接下来您必须做的是:
install.packages("devtools")
5.2 Install RTools . 5.2 安装RTools 。 Follow the steps explained here .按照此处说明的步骤操作。
5.3 Install IRkernel . 5.3 安装IRkernel 。 Follow the steps explained here .按照此处说明的步骤操作。
Now, your R kernel is set and ready to go!现在,您的 R 内核已设置并准备就绪!
Hope it helps希望能帮助到你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.