ERROR: compilation failed for package 'LDheatmap' - r

I am trying to install LDheatmap R package but keep getting this error.
devtools::install_github("SFUStatgen/LDheatmap", force = TRUE)
Downloading GitHub repo SFUStatgen/LDheatmap#HEAD
Skipping 1 packages not available: snpStats
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file 'C:\Users\vinit\AppData\Local\Temp\RtmpUnSSwg\remotes4c44719014b9\SFUStatgen-LDheatmap-a727a02/DESCRIPTION' ...
─ preparing 'LDheatmap':
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a 'data/datalist' file should be added
─ building 'LDheatmap_1.0-5.tar.gz'
Installing package into ‘C:/Users/vinit/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
installing source package 'LDheatmap' ...
** using staged installation
** libs
g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I'C:/Users/vinit/AppData/Local/R/win-library/4.2/Rcpp/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c GT_to_SnpMatrix.cpp -o GT_to_SnpMatrix.o
/bin/sh: line 1: g++: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:260: GT_to_SnpMatrix.o] Error 127
ERROR: compilation failed for package 'LDheatmap'
removing 'C:/Users/vinit/AppData/Local/R/win-library/4.2/LDheatmap'
Warning message:
In i.p(...) :
installation of package ‘C:/Users/vinit/AppData/Local/Temp/RtmpUnSSwg/file4c443bb22ac4/LDheatmap_1.0-5.tar.gz’ had non-zero exit status

Related

Trouble with install_github("chrchang/plink-ng", subdir="/2.0/cindex") on mac M1

I am attempting to install and use Snpnet from https://github.com/rivas-lab/snpnet which is an R package. I normally code in python but the package is only available in R so am a bit new to this so appreciate any feedback and wondering if others are having the same issues. I think it has something to do with the M1 chip as it the package downloaded to an older windows machine. Does anyone know of a workaround? Many thanks.
The package has the following dependencies, three of which downloaded fine:
> library(devtools) #works
> install_github("junyangq/glmnetPlus") #works
> install_github("chrchang/plink-ng", subdir="/2.0/cindex") #doesn't work
> install_github("chrchang/plink-ng", subdir="/2.0/pgenlibr") #works
Here is the error message in Rstudio:
> install_github("chrchang/plink-ng", subdir="/2.0/cindex")
Downloading GitHub repo chrchang/plink-ng#HEAD
── R CMD build ───────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/1d/lpq4v17s307fq1qyj452zpvc0000gn/T/RtmpVSVW2P/remotes10d558f4ea37/chrchang-plink-ng-8203270/2.0/cindex/DESCRIPTION’ ...
─ preparing ‘cindex’:
✔ checking DESCRIPTION meta-information
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘cindex_0.2.tar.gz’
* installing *source* package ‘cindex’ ...
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -march=native -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include -I/usr/local/include -Xclang -fopenmp -fPIC -falign-functions=64 -Wall -g -O2 -c include/plink2_base.cc -o include/plink2_base.o
clang: error: the clang compiler does not support '-march=native'
make: *** [include/plink2_base.o] Error 1
ERROR: compilation failed for package ‘cindex’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/cindex’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/1d/lpq4v17s307fq1qyj452zpvc0000gn/T//RtmpVSVW2P/file10d5238e27bb/cindex_0.2.tar.gz’ had non-zero exit status

Installing packages from source in renv

I need to install a package from source in renv. I can install packages from binaries in renv no problem. I can also install packages from both source & binary outside renv no problem. I am doing this within Rstudio
The error (below) makes me think it cant find the compiler. Digging around I found a thread about this that says renv cant find Rtools and then you need to run renv:::renv_scope_rtools() to resolve this but this just gives the message FAIL and the problem remains. Can anyone help?
thanks
install.packages("xfun")
Retrieving 'https://cloud.r-project.org/src/contrib/xfun_0.37.tar.gz' ...
OK [file is up to date]
Installing xfun [0.37] ...
FAILED
Error installing package 'xfun':
================================
* installing *source* package 'xfun' ...
** package 'xfun' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"C:/PROGRA~1/R/R-42~1.2/include" -DNDEBUG -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:253: base64.o] Error 127
ERROR: compilation failed for package 'xfun'
* removing 'D:/Dropbox/project X/renv/staging/3/xfun'

Unable to install a package called 'hemp' in R

I am new to learning R and i get the following error while installing the package called 'hemp'. Its a package which is used in psychometric analysis. Can anyone tell me what causes this errror?
Downloading GitHub repo cddesja/hemp#master
Installing 1 packages: nloptr
Installing package into ‘C:/Users/UJJWAL/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
There is a binary version available but the
source version is later:
binary source needs_compilation
nloptr 1.2.2.1 1.2.2.2 TRUE
installing the source package ‘nloptr’
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.2.2.2.tar.gz'
Content type 'application/x-gzip' length 2450931 bytes (2.3 MB)
downloaded 2.3 MB
* installing *source* package 'nloptr' ...
** package 'nloptr' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
*** arch - i386
/mingw32/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c dummy.cpp -o dummy.o
/mingw32/bin/gcc -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I"/i386/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_nloptr.c -o init_nloptr.o
init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
#include "nlopt.h"
^~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-4.0.2/etc/i386/Makeconf:222: init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing 'C:/Users/UJJWAL/Documents/R/win-library/4.0/nloptr'
Error: Failed to install 'hemp' from GitHub:
(converted from warning) installation of package ‘nloptr’ had non-zero exit status
Seems that it wouldbe a little harder to install nloptr on Windows. It require nlopt to be installed first. See this for more info: https://www.r-project.org/nosvn/pandoc/nloptr.html

Problems to install zoo package, Error: sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory

I tried to install the zoo package via the R package installer:
install.packages("C:/Users/srues/Downloads/zoo_1.8-8.tar.gz", repos = NULL, type = "source")
but I get the following error
Installing package into ‘C:/Users/srues/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
* installing *source* package 'zoo' ...
** Paket 'zoo' erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -I../inst/include -O3 -Wall -std=gnu99 -mtune=generic -c coredata.c -o coredata.o
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:208: coredata.o] Error 127
ERROR: compilation failed for package 'zoo'
* removing 'C:/Users/srues/Documents/R/win-library/3.6/zoo'
* restoring previous 'C:/Users/srues/Documents/R/win-library/3.6/zoo'
Warning in install.packages :
installation of package ‘C:/Users/srues/Downloads/zoo_1.8-8.tar.gz’ had non-zero exit status
the line
sh: c:/Rtools/mingw_32/bin/gcc: No such file or directory
says it miss the directory or file. What I have to do to find this file or directory? Or can I install the zoo package over Rtool40?

Issues about installing an R package from Github (non-zero exit status?)

I am trying to install an R package from Github. But I come across the following issue. Does anyone has does how to solve this? Any comments or suggestions would be greatly appreciated. Thanks!
devtools::install_github("gregorkb/QregBB")
Downloading GitHub repo gregorkb/QregBB#master
✔ checking for file ‘/private/var/folders/sq/lj12xtts7r9fbjblz_y8q8dh0000gn/T/RtmpSg1adc/remotes18a031a3335d/gregorkb-QregBB-cf0ee46/DESCRIPTION’ (372ms)
─ preparing ‘QregBB’:
✔ checking DESCRIPTION meta-information ...
─ cleaning src
─ installing the package to process help pages
─ saving partial Rd database (14.9s)
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘QregBB_1.0.tar.gz’
installing source package ‘QregBB’ ...
** using staged installation
** libs
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -Wall -g -O2 -c QregBB.c -o QregBB.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o QregBB.so QregBB.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-QregBB/00new/QregBB/libs
** R
** byte-compile and prepare package for lazy loading
** help
Error : (converted from warning) /private/var/folders/sq/lj12xtts7r9fbjblz_y8q8dh0000gn/T/Rtmp0W7UGP/Rbuild191c5c79437f/QregBB/man/QregBB-package.Rd:28: All text must be in a section
ERROR: installing Rd objects failed for package ‘QregBB’
removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/QregBB’
Error: Failed to install 'QregBB' from GitHub:
(converted from warning) installation of package ‘/var/folders/sq/lj12xtts7r9fbjblz_y8q8dh0000gn/T//RtmpSg1adc/file18a07a8be6ad/QregBB_1.0.tar.gz’ had non-zero exit status

Resources