简体   繁体   English

从github安装R软件包时出错:找不到构建data.table所需的构建工具

[英]Error when installing an R package from github: Could not find build tools necessary to build data.table

From within RStudio I'm trying to install the data.table package from github following these instructions , and the package seems to download without a problem: 从RStudio内部,我尝试按照以下说明从github安装data.table程序包,该程序包似乎可以顺利下载:

> library(devtools)
> dev_mode(on=T)
Dev mode: ON
d> install_github("Rdatatable/data.table")
Downloading GitHub repo Rdatatable/data.table@master
from URL https://api.github.com/repos/Rdatatable/data.table/zipball/master

I then receive the following prompt: 然后,我收到以下提示:

Building R package from source requires installation of additional build tools. 从源代码构建R软件包需要安装其他构建工具。 Do you want to install the additional tools now? 您是否要立即安装其他工具?

Selecting "Yes" results in this error message: 选择“是”将导致此错误消息:

Error: Could not find build tools necessary to build data.table

Thinking this might be an RStudio problem, I tried installing the package in the standard R console, but this also resulted in an error: 考虑到这可能是一个RStudio问题,我尝试在标准R控制台中安装该软件包,但这也会导致错误:

Downloading GitHub repo Rdatatable/data.table@master
from URL https://api.github.com/repos/Rdatatable/data.table/zipball/master
Installing data.table
"C:/PROGRA~1/R/R-33~1.0/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  "C:/Users/Robert/AppData/Local/Temp/RtmpOOKOKu/devtools246832c52ab/Rdatatable-data.table-4348ff4"  \
  --library="C:/Users/Robert/Documents/R-dev" --install-tests 

* installing *source* package 'data.table' ...
** libs
c:/Rtools/mingw_64/bin/gcc  -I"C:/PROGRA~1/R/R-33~1.0/include" -DNDEBUG     -I"d:/Compiler/gcc-4.9.3/local330/include"  -fopenmp   -O2 -Wall  -std=gnu99 -mtune=core2 -c assign.c -o assign.o
c:/Rtools/mingw_64/bin/gcc: not found
make: *** [assign.o] Error 127
Warning: running command 'make -f "Makevars" -f "C:/PROGRA~1/R/R-33~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-33~1.0/share/make/winshlib.mk" SHLIB="data.table.dll" WIN=64 TCLBIN=64 OBJECTS="assign.o bmerge.o chmatch.o dogroups.o fastmean.o fcast.o fmelt.o forder.o frank.o fread.o fwrite.o gsumm.o ijoin.o init.o openmp-utils.o quickselect.o rbindlist.o reorder.o shift.o subset.o transpose.o uniqlist.o vecseq.o wrappers.o"' had status 2
ERROR: compilation failed for package 'data.table'
* removing 'C:/Users/Robert/Documents/R-dev/data.table'
Error: Command failed (1)
d>

I found three related posts on SO: 我在SO上找到了三个相关的帖子:

Error: Could not find build tools necessary to build dplyr 错误:找不到构建dplyr所需的构建工具

Error : Could not find build tools necessary to build 错误:找不到构建所需的构建工具

Could not find build tools necessary . 找不到必要的构建工具。 Facing error with devtools devtools面对错误

The first two seem specific to Apple OS, and the third suggests an error specific to devtools, but I don't know if that's the source of the error I'm seeing. 前两个似乎是Apple OS特有的,第三个是devtools特有的错误,但我不知道这是否是我所看到的错误的来源。

Any help would be appreciated. 任何帮助,将不胜感激。 I'm running R version 3.3.0 in Windows 10. 我正在Windows 10中运行R版本3.3.0。

You need to install Rtools when working under Windows. 在Windows下工作时,需要安装Rtools It's crucial that you download and select the correct version. 下载并选择正确的版本至关重要。 Run

R.version

to get your version of R. 获得您的R版本。

After installing, you'll probably need to restart R. 安装后,您可能需要重新启动R。

You can try: 你可以试试:

options(buildtools.check = function(action) TRUE )

which is included in https://support.rstudio.com/hc/en-us/community/posts/212725628-Bug-report-with-devtools-install-github-in-RStudio-v0-99-1273-Preview-and-previously-with-Version-0-99-896 这包含在https://support.rstudio.com/hc/zh-CN/community/posts/212725628-Bug-report-with-devtools-install-github-in-RStudio-v0-99-1273-Preview-以及以前的版本-0-99-896

... should suppress RStudio's attempts to validate your build tools. ...应该抑制RStudio验证您的构建工具的尝试。

It works for me. 这个对我有用。

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

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