没有从RStudio检测到Rtools

时间:2021-12-07 13:11:20

I am using latest R, RStudio and Rtools.

我正在使用最新的R, RStudio和Rtools。

-- I have updated the environment variables. Now I can call gcc, or R from command line.

——我更新了环境变量。现在我可以从命令行调用gcc,或者R。

While I was trying to publish an app from the RStudio, I get the following error,

当我试图从RStudio发布一个应用程序时,我得到了以下错误,

Preparing to deploy application...DONE Uploading bundle for application: 64015...Error: * Application depends on package "Rtools" but it is not installed. Please resolve before continuing. Execution halted

准备部署应用程序…完成上传捆绑申请:64015…错误:*应用程序依赖于软件包“Rtools”,但它没有安装。请在继续前解决。停止执行

-- I have tried this,On Console,

我试过了,在控制台,

> find_rtools(T)
Scanning path...
ls : D:\Rtools\bin\ls.exe 
gcc: D:\Rtools\GCC-46~1.3\bin\gcc.exe 
VERSION.txt
Rtools version 3.3.0.1959 
Version: 3.3 
[1] TRUE

So, Rtools seems basically there!

所以,Rtools基本上就在那里!

-- I have checked environment variables, those are OK, as I also mentioned R and gcc can be started from command line

——我检查了环境变量,这些是可以的,因为我还提到了可以从命令行开始R和gcc

Yet, I tried to install and check from within RStudio using installr package, it says,

但是,我尝试使用installr包在RStudio中安装和检查,它说,

> install.Rtools()
No need to install Rtools - You've got the relevant version of Rtools installed
> 

-- This is not a possible duplication of this, Rtools not being detected by R I have tried all these. Did not work.

这是不可能的复制,Rtools不会被R检测到我已经试过所有这些。没有工作。

Please suggest a solution. Thank you very much for your time.

请建议一个解决方案。非常感谢您的时间。

2 个解决方案

#1


9  

I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:

我不知道为什么RStudio有时会有这样的问题,但是这里有一个手工工作描述:

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

Basically you have to set two environment variables to the correct installation path of Rtools:

基本上,您必须将两个环境变量设置为Rtools的正确安装路径:

Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")

To avoid losing this change after restarting RStudio you could modify your Windows environment variables instead or add the following rows to your .Renviron file that is executed at each startup of R.

为了避免在重新启动RStudio之后丢失此更改,您可以修改Windows环境变量,或者将以下行添加到在每次启动R时执行的. renvironment文件中。

BTW: The $(WIN) part is no typo but required so that R can inject "32" or "64" depending on the R version you are using (32 or 64 bit).

顺便说一句:$(WIN)部分没有输入错误,但是需要输入,这样R就可以根据您使用的R版本(32位或64位)注入“32”或“64”。

Edit 1:: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

编辑1:查看最近发表的r-blogger文章:https://www.r-bloggers.com/quirks-about-running-rcpp-on-window -through-rstudio/

#2


0  

Note that there are new potential kinds of problems (from R 3.3 onwards), since R (not RStudio, but R) adds a BINPREF variable and modifies the Path variable by default, see the Renviron.site file for the latter, on Windows typically e.g. under C:\Program Files\R\R-3.4.3\etc:

注意,还有一些新的潜在问题(从r3.3开始),因为R(不是RStudio,而是R)添加了一个BINPREF变量,并默认修改了Path变量,请参见Renviron。网站文件对于后者,在Windows下通常如C:\Program Files\R\R-3.4.3\等:

PATH="C:\Rtools\bin;${PATH}" 

This might easily conflict for people with a custom path and/or multiple versions of Rtools installed, so I have commented this out with a #.

对于安装了自定义路径和/或多个版本的Rtools的人来说,这很容易发生冲突,因此我用#注释了这一点。

For the BINPREF problem, see the Makeconf file, e.g. under C:\Program Files\R\R-3.4.3\etc\x64:

BINPREF问题,请参见Makeconf文件,例如在C:\Program Files\R\R-3.4.3\etc\ x64:

BINPREF ?= c:/Rtools/mingw_64/bin/

I have then modified this to c:/Rtools34/mingw_64/bin/, which is where I have installed my Rtools34.
You can do the same for the Makeconf file under the 32-bit arch. sub-directory.

然后我将其修改为c:/Rtools34/mingw_64/bin/,这就是我安装Rtools34的地方。您可以对32位arch下的Makeconf文件执行相同的操作。子目录。

#1


9  

I have no idea why RStudio has such kind of problems from time to time but there is a manual work-around described here:

我不知道为什么RStudio有时会有这样的问题,但是这里有一个手工工作描述:

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

https://github.com/rwinlib/r-base/wiki/Testing-Packages-with-Experimental-R-Devel-Build-for-Windows

Basically you have to set two environment variables to the correct installation path of Rtools:

基本上,您必须将两个环境变量设置为Rtools的正确安装路径:

Sys.setenv(PATH = paste("C:/Rtools/bin", Sys.getenv("PATH"), sep=";"))
Sys.setenv(BINPREF = "C:/Rtools/mingw_$(WIN)/bin/")

To avoid losing this change after restarting RStudio you could modify your Windows environment variables instead or add the following rows to your .Renviron file that is executed at each startup of R.

为了避免在重新启动RStudio之后丢失此更改,您可以修改Windows环境变量,或者将以下行添加到在每次启动R时执行的. renvironment文件中。

BTW: The $(WIN) part is no typo but required so that R can inject "32" or "64" depending on the R version you are using (32 or 64 bit).

顺便说一句:$(WIN)部分没有输入错误,但是需要输入,这样R就可以根据您使用的R版本(32位或64位)注入“32”或“64”。

Edit 1:: See also this r-bloggers article published recently: https://www.r-bloggers.com/quirks-about-running-rcpp-on-windows-through-rstudio/

编辑1:查看最近发表的r-blogger文章:https://www.r-bloggers.com/quirks-about-running-rcpp-on-window -through-rstudio/

#2


0  

Note that there are new potential kinds of problems (from R 3.3 onwards), since R (not RStudio, but R) adds a BINPREF variable and modifies the Path variable by default, see the Renviron.site file for the latter, on Windows typically e.g. under C:\Program Files\R\R-3.4.3\etc:

注意,还有一些新的潜在问题(从r3.3开始),因为R(不是RStudio,而是R)添加了一个BINPREF变量,并默认修改了Path变量,请参见Renviron。网站文件对于后者,在Windows下通常如C:\Program Files\R\R-3.4.3\等:

PATH="C:\Rtools\bin;${PATH}" 

This might easily conflict for people with a custom path and/or multiple versions of Rtools installed, so I have commented this out with a #.

对于安装了自定义路径和/或多个版本的Rtools的人来说,这很容易发生冲突,因此我用#注释了这一点。

For the BINPREF problem, see the Makeconf file, e.g. under C:\Program Files\R\R-3.4.3\etc\x64:

BINPREF问题,请参见Makeconf文件,例如在C:\Program Files\R\R-3.4.3\etc\ x64:

BINPREF ?= c:/Rtools/mingw_64/bin/

I have then modified this to c:/Rtools34/mingw_64/bin/, which is where I have installed my Rtools34.
You can do the same for the Makeconf file under the 32-bit arch. sub-directory.

然后我将其修改为c:/Rtools34/mingw_64/bin/,这就是我安装Rtools34的地方。您可以对32位arch下的Makeconf文件执行相同的操作。子目录。