1

I cannot install package data.table on AWS EC2 instance. Below the error I have.

* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** libs
Warning: R include directory is empty -- perhaps need to install R-devel.rpm or similar
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG   -I/usr/local/include  -fopenmp -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c assign.c -o assign.o
In file included from assign.c:1:0:
data.table.h:1:15: fatal error: R.h: No such file or directory
 #include <R.h>
               ^
compilation terminated.
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/home/user1/R/x86_64-redhat-linux-gnu-library/3.4/data.table’
Warning in install.packages :
  installation of package ‘data.table’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpMTCCET/downloaded_packages’

I tried to create a MakeVars file (in .R folder) containing:

CC = /usr/bin/gcc64
CXX = /usr/bin/g++
SHLIB_OPENMP_CFLAGS = -fopenmp

But it does not change anything. Maybe the paths of MakeVars file are wrong? Thanks !

EDIT:
enter image description here

ML_Enthousiast
  • 1,147
  • 1
  • 15
  • 39
  • 2
    I'd speculate that you need to `sudo apt-get install r-base-dev` first. – Michael - sqlbot May 20 '18 at 22:22
  • I already did it. – ML_Enthousiast May 21 '18 at 09:16
  • If you type `locate R.h`... Is it found? – Michael - sqlbot May 21 '18 at 11:38
  • I will edit my post to show you what it does. – ML_Enthousiast May 21 '18 at 20:46
  • 1
    My mistake... I was assuming you were using Ubuntu. The packages on Amazon Linux are usually named different things. Possibly you need `sudo yum install R-devel`. https://stackoverflow.com/a/20128351/1695906 – Michael - sqlbot May 21 '18 at 22:42
  • Thank you !! Installed fine after that. Do you think I should keep the MakeVars file or it does not change anything? – ML_Enthousiast May 23 '18 at 11:23
  • I couldn't tell you. You may laugh when I confess that not only have I never compiled anything for/using R, I've never even used R at all. But when compiling things in C/C++, you typically need the development files (which includes header (`.h`) files) for whatever you are linking against and these are in a separate -dev/-devel package (e.g., if you are compiling a program that uses curl to make web requests, and openssl for HTTPS, there's libcurl-openssl-dev). I assumed this to be a similar case. It was one of those "lucky guesses" made easier by years of general experience (and google). – Michael - sqlbot May 23 '18 at 13:25
  • You might also look into yum install mlocate. I believe this is what installs the locate utility on CentOS, which builds/updates an index of all your files every night, for speeding up the procress of finding files without scanning the entire drive. – Michael - sqlbot May 23 '18 at 13:29

1 Answers1

1

Worked fine after doing in Centos:

sudo yum install R-devel

Thanks @Michael - sqlbot!

ML_Enthousiast
  • 1,147
  • 1
  • 15
  • 39