16

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:

> 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. 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:

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:

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

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.

Any help would be appreciated. I'm running R version 3.3.0 in Windows 10.

Community
  • 1
  • 1
Robert
  • 2,111
  • 4
  • 18
  • 32
  • @Procrastinatus Thanks for that link. When I execute the install.packages command described in those instructions, R reports "installation of package ‘data.table’ had non-zero exit status". In the interest of time, I'm going to skip this for now, and just use data.frame instead of data.table. – Robert Jun 12 '16 at 16:48
  • 1
    Why not use the [CRAN version](https://cran.r-project.org/web/packages/data.table/index.html) instead of the development version? – Jaap Jun 12 '16 at 16:50
  • 2
    Because my code is affected by a bug that's fixed in the dev version. – Robert Jun 12 '16 at 16:51
  • 1
    It´s clear why your error occurs: You don´t have this package installed. Try to install RTools (see link in the first comment) – J_F Jun 12 '16 at 16:54

2 Answers2

25

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

... should suppress RStudio's attempts to validate your build tools.

It works for me.

Minstein
  • 542
  • 5
  • 10
1

You need to install Rtools when working under Windows. It's crucial that you download and select the correct version. Run

R.version

to get your version of R.

After installing, you'll probably need to restart R.

csgillespie
  • 59,189
  • 14
  • 150
  • 185