简体   繁体   中英

R package 'data.table' cannot be installed. - mac air

My laptop is a mac pro. The OS version is 10.15 Catalina. The r studio version is 1.2.5001. The R version is 3.6.1.

I tried to install "WGCNA", but it failed because of the following error:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called ‘data.table’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
ERROR: lazy loading failed for package ‘WGCNA’
* removing ‘/Users/zhaoboao/Library/R/3.6/library/WGCNA’

Therefore, I installed 'data.table', but it also failed because of the following error:

* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp -fPIC  -Wall -g -O2  -c assign.c -o assign.o
clang: error: unsupported option '-fopenmp'
make: *** [assign.o] Error 1
ERROR: compilation failed for package ‘data.table’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/data.table’

Can anyone help me to solve this problem? I really appreciate it!

First of all...welcome to what I think is the best online community for R users! (though others may disagree)

To address your question, I absolutely empathize with your frustration. I also had a horrid time trying to get the package data.table to install in R after updating to Catalina. Being a little better than a novice with the terminal at best, I still need a moderate amount of hand holding which I think accounts for many others as well. The only set of step by step directions that worked for me was laid out at The Coatless Professor .

On a side note, I did install updated versions of clang and gfortran using clang-8.0.0 and gfortran-6.1 , respectively. Both of these can be found on the R for Mac OS X Development Tools and Libraries by selecting this link . However, if you use the stepwise directions, I'd advise installing them when it is brought up.

I only bring this up because it is easy to miss but the very last thing is to make sure you use the correct version of clang when running step #3 under INSTALLING THE CLANG7 R BINARY. In my case, I had to change the version 7 of clang to 8 by amending echo 'PATH="/usr/local/clang7/bin:${PATH}"' >> ~/.Renviron to echo 'PATH="/usr/local/clang8/bin:${PATH}"' >> ~/.Renviron .

I hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM