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

时间:2016-06-12 16:07:26

标签: r devtools

从RStudio中我试图在these instructions之后从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

然后我收到以下提示:

  

从源代码构建R包需要安装额外的   构建工具。您想现在安装其他工具吗?

选择"是"导致此错误消息:

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

认为这可能是一个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>

我在SO上发现了三个相关帖子:

Error: Could not find build tools necessary to build dplyr

Error : Could not find build tools necessary to build

Could not find build tools necessary . Facing error with devtools

前两个似乎特定于Apple OS,第三个表示devtools特有的错误,但我不知道这是否是我看到的错误的来源。

任何帮助将不胜感激。我在Windows 10中运行R版本3.3.0。

2 个答案:

答案 0 :(得分:1)

在Windows下工作时需要安装Rtools。下载并选择正确的版本至关重要。运行

R.version

获取您的R版本。

安装完成后,您可能需要重新启动R.

答案 1 :(得分:0)

您可以尝试:

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

包含在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

  

...应该禁止RStudio尝试验证您的构建工具。

对我有用。