Rdatatable / data.table

R's data.table package extends data.frame:
http://r-datatable.com
Mozilla Public License 2.0
3.62k stars 985 forks source link

data.table install error on macosx #4702

Closed michelefioretti closed 3 years ago

michelefioretti commented 4 years ago

Click preview tab ^^^ above!

By continuing to file this new issue / feature request, I confirm I have :

  1. searched the live NEWS file to see if it has been fixed in dev already. If so, I tried the latest dev version.
  2. looked at the titles of all the issues in the current milestones and am aware of those. (Adding new information to existing issues is very helpful and appreciated.)
  3. searched all issues (i.e. not in a milestone yet) for similar issues to mine and will include links to them explaining why mine is different.
  4. searched on Stack Overflow's data.table tag and there is nothing similar there.
  5. read the Support and Contributing guides.
  6. please don't tag your issue with text in the title; project members will add the appropriate tags later.

Thanks! Please remove the text above and include the two items below.

# Minimal reproducible example

# Output of sessionInfo()

michelefioretti commented 4 years ago

Hi, I have the following error at installing data.table

install.packages("data.table")

  There is a binary version available but the source version is later:
           binary source needs_compilation
data.table 1.12.8 1.13.0              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘data.table’

trying URL 'https://cran.rstudio.com/src/contrib/data.table_1.13.0.tar.gz'
Content type 'application/x-gzip' length 5273400 bytes (5.0 MB)
==================================================
downloaded 5.0 MB

* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** using staged installation
*** pkg-config is not installed.
*** Compilation will now be attempted and if it works you can ignore this message. However,
*** if compilation fails, try 'locate zlib.h zconf.h' and ensure the zlib development library
*** is installed :
***   deb: zlib1g-dev (Debian, Ubuntu, ...)
***   rpm: zlib-devel (Fedora, EPEL, ...)
***   brew: zlib (OSX)
*** Note that zlib is required to compile R itself so you may find the advice in the R-admin
*** guide helpful regarding zlib. On Debian/Ubuntu, zlib1g-dev is a dependency of r-base as
*** shown by 'apt-cache showsrc r-base | grep ^Build-Depends | grep zlib', and therefore
*** 'sudo apt-get build-dep r-base' should be sufficient too.
*** To silence this message, please ensure that :
***   1) 'pkg-config --exists zlib' succeeds (i.e. $? -eq 0)
***   2) 'pkg-config --libs zlib' contains -lz
*** Compilation will now be attempted ...
** libs
/usr/local/Cellar/gcc/9.2.0/bin/gcc-9 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c assign.c -o assign.o
/bin/sh: /usr/local/Cellar/gcc/9.2.0/bin/gcc-9: No such file or directory
make: *** [assign.o] Error 127
ERROR: compilation failed for package ‘data.table’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/data.table’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/data.table’
Warning in install.packages :
  installation of package ‘data.table’ had non-zero exit status

Would you know how to solve this issue? If I don't install it from source it does not give me an error, but also it does not update the package.

matthewgson commented 4 years ago

Hope this helps, this worked for me.

  1. install homebrew, Apple Xcode

  2. install llvm, pkg-config from Homebrew

  3. make Makevars file at ~/.R/Makevars

    
    #if you downloaded llvm manually above, replace with your chosen NEW_PATH/clang
    LLVM_LOC = /usr/local/opt/llvm
    CC=$(LLVM_LOC)/bin/clang -fopenmp
    CXX=$(LLVM_LOC)/bin/clang++ -fopenmp
    CXX11 = $(LLVM_LOC)/bin/clang++ -fopenmp # for fst package

-O3 should be faster than -O2 (default) level optimisation ..

CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LLVM_LOC)/include



4. Install package from source 
install.packages('data.table', type='source')

Please refer to below links

[Wiki](https://github.com/Rdatatable/data.table/wiki/Installation#openmp-enabled-compiler-for-mac)
[comment1](https://github.com/Rdatatable/data.table/issues/4581#issuecomment-659976021)
[comment2](https://github.com/Rdatatable/data.table/issues/4574#issuecomment-660146163)
jangorecki commented 3 years ago

@michelefioretti please let us know if suggestion posted in September didn't help you to resolve your problem.

michelefioretti commented 3 years ago

Yes, I solved the problem. Thank you so much!

All the best,

Michele

On Nov 23, 2020, at 9:49 AM, Jan Gorecki notifications@github.com wrote:

Closed #4702 https://github.com/Rdatatable/data.table/issues/4702.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Rdatatable/data.table/issues/4702#event-4026464345, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGBSNFAYEOLM3BRP43AI5C3SRIO25ANCNFSM4RHWPJQQ.