Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

devtools

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.

like image 731
Robert Avatar asked Jun 12 '16 16:06

Robert


People also ask

Why I Cannot install package in R?

Changing the configuration in R Studio to solve install packages issue. Go To Tools -> Global option -> Packages. Then uncheck the option “Use secure download method for HTTP”. For other RStudio issues refer to official Troubleshooting Guide here.


2 Answers

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.

like image 124
Minstein Avatar answered Oct 09 '22 07:10

Minstein


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.

like image 37
csgillespie Avatar answered Oct 09 '22 07:10

csgillespie