简体   繁体   English

package 安装期间未找到 Rtools 4.0

[英]Rtools 4.0 not found during package installation

For many R packages I try to install (on my Windows 10 machine), I get a warning:对于我尝试安装的许多 R 软件包(在我的 Windows 10 机器上),我收到警告:

> install.packages('rstan')
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

I thought this was just an erroneous error message since the installation seemed to proceed anyway, but recently I tried to install a package (rstan) and found it completely nonfunctional.我认为这只是一个错误的错误消息,因为安装似乎仍在继续,但最近我尝试安装 package (rstan) 并发现它完全不起作用。 My hunch is that since rstan relies completely on compiling code with rcpp, maybe I only got away with the previous packages because I wasn't using the functions in them that relied on Rtools.我的预感是,由于 rstan完全依赖于使用 rcpp 编译代码,也许我只是摆脱了以前的包,因为我没有使用它们中依赖于 Rtools 的函数。

I reinstalled Rtools 4.0, and devtools::find_rtools() returns TRUE .我重新安装了 Rtools 4.0,并且devtools::find_rtools()返回TRUE But when I run Sys.getenv()['PATH'] there is no Rtools on the path.但是当我运行Sys.getenv()['PATH']时,路径上没有 Rtools。 There isn't a place in the installation process to tell it I want Rtools on the path either, so these instructions don't help - the menus they refer to don't exist for me.安装过程中也没有地方告诉它我想要 Rtools 在路径上,所以这些说明没有帮助 - 他们引用的菜单对我来说不存在。 So I thought this might be an issue where the new Rtools 4.0 doesn't put itself on the system path.所以我认为这可能是新的 Rtools 4.0 没有将自己放在系统路径上的问题。 But the problem persisted even after I directly edited the Windows path environment variables (both system and user versions) to include the path given to me by pkgbuild::rtools_path() ( C:\rtools40\usr\bin , a path which both exists and appears to be correct).但是即使在我直接编辑 Windows 路径环境变量(系统和用户版本)以包含pkgbuild::rtools_path()给我的路径( C:\rtools40\usr\bin ,两者都存在的路径后,问题仍然存在并且似乎是正确的)。

This doesn't seem to be the same problem as Rtools 4.0 (Rstudio falsely claims it was deleted) , since there are no claims Rtools was deleted.这似乎与Rtools 4.0 的问题不同(Rstudio 错误地声称它已被删除) ,因为没有声称 Rtools 已被删除。 It's also not the same as Rtools not being detected by R as far as I can tell: I'm not leaving any features out of my Rtools installation - I'm not even getting the option to in my install wizard.据我所知,它与R 未检测到 Rtools 也不相同:我没有在 Rtools 安装中留下任何功能 - 我什至没有在我的安装向导中获得选项。

Would appreciate any advice or recommendations.将不胜感激任何意见或建议。

Rtools40 requires that you add its bin directory to your PATH variable. Rtools40要求您将其 bin 目录添加到PATH变量中。 The full instructions are here .完整的说明在这里

You can update your ~/.Renviron file with any of the following methods:您可以使用以下任何方法更新您的~/.Renviron文件:

You can do that manually by opening ~/.Renviron and putting the following in it:您可以通过打开~/.Renviron并将以下内容手动执行此操作:

PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

You can also use R (Gui or RStudio or Shell) with the following:您还可以将 R(Gui 或 RStudio 或 Shell)与以下内容一起使用:

writeLines(
    'PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"',
    con = file("~/.Renviron", open = "a")
)

Both of these methods require a restart of R.这两种方法都需要重启 R。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM