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

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

Related

ERROR: compilation failed for package 'LDheatmap'

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

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

when installing a R package, fatal error: R.h: No such file or directory, How to locate R.h?

when installing a R package from github
install_github("DataSlingers/ExclusiveLasso")
I get the error messages:
* installing *source* package 'ExclusiveLasso' ...
** using staged installation
** libs
g++ -std=gnu++11 -I"/include" -DNDEBUG -I'D:/R-4.2.2/library/Rcpp/include' -I'D:/R-4.2.2/library/RcppArmadillo/include' -I"D:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c ExclusiveLasso.cpp -o ExclusiveLasso.o
In file included from D:/R-4.2.2/library/Rcpp/include/RcppCommon.h:30,
from D:/R-4.2.2/library/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25,
from D:/R-4.2.2/library/RcppArmadillo/include/RcppArmadillo.h:29,
from ExclusiveLasso.cpp:23:
D:/R-4.2.2/library/Rcpp/include/Rcpp/r/headers.h:66:10: fatal error: R.h: No such file or directory
66 | #include <R.h>
| ^~~~~
compilation terminated.
make: *** [D:/R-4.2.2/etc/x64/Makeconf:260:ExclusiveLasso.o] 错误 1
ERROR: compilation failed for package 'ExclusiveLasso'
* removing 'D:/R-4.2.2/library/ExclusiveLasso'
I know where my R.h at, and I tried change
#include <R.h>
into
#include <D:/R-4.2.2/include>,
but there's too many files and errors like this
It seems that I should tell the g++ where to find D:/R-4.2.2/include, can someone guide me whether I should do that or what should I do.
I's using:
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Using vscode
Works fine here on Ubuntu 22.10. Note in the log below how it uses -I"/usr/share/R/include" (which is something R itself adds) to point to R's headers. So to me it looks like your R installation is at fault because the src/Makevars.win in that repo is very standard and mostly likely correct.
edd#rob:~$ installGithub.r DataSlingers/ExclusiveLasso # wrapper around install_github()
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo DataSlingers/ExclusiveLasso#HEAD
Skipping 1 packages ahead of CRAN: Rcpp
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/tmp/remotes2ac86f2646632b/DataSlingers-ExclusiveLasso-ed6b729/DESCRIPTION’ ...
─ preparing ‘ExclusiveLasso’:
✔ 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 ‘ExclusiveLasso_0.0.tar.gz’
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘ExclusiveLasso’ ...
** using staged installation
** libs
ccache g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c ExclusiveLasso.cpp -o ExclusiveLasso.o
ccache g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes -c RcppExports.cpp -o RcppExports.o
ccache g++ -std=gnu++11 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o ExclusiveLasso.so ExclusiveLasso.o RcppExports.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug *.o *.so; fi
if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Darwin" ]] ; then /usr/bin/strip -S *.o *.so; fi
installing to /usr/local/lib/R/site-library/00LOCK-ExclusiveLasso/00new/ExclusiveLasso/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ExclusiveLasso)
edd#rob:~$
Looking at your installation attempt confirms that because you have
g++ -std=gnu++11 -I"/include"
so R does not figure out where its installation is. Normally you should have
edd#rob:~$ R RHOME
/usr/lib/R
edd#rob:~$
but I suspect that too is borked at your end.

Can not install Quantstrat from github

Have followed the processes outlined on the Github repo.
Have tried installed blotter first and then quantstrat. Doesnt work
Have then moved to installing all dependencies first.
install.packages("FinancialInstrument",repos="https://github.com/braverock/FinancialInstrument")
When trying to install from Github using devtools get the following error.
devtools::install_github("braverock/blotter")
Downloading GitHub repo braverock/blotter#master
✓ checking for file ‘/private/var/folders/_8/zy8__ntx5cx0_lnbybvfjhsr0000gp/T/Rtmp0wtY3O/remotes2547e2faf85/braverock-blotter-67be2c8/DESCRIPTION’ (400ms)
─ preparing ‘blotter’:
✓ 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 ‘blotter_0.14.8.tar.gz’
installing source package ‘blotter’ ...
** 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 calcPosAvgCost.c -o calcPosAvgCost.o
calcPosAvgCost.c:31:12: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
if(abs(d_PrevPosQty) > abs(d_PosQty[i])){
^
calcPosAvgCost.c:31:12: note: use function 'fabs' instead
if(abs(d_PrevPosQty) > abs(d_PosQty[i])){
^~~
fabs
calcPosAvgCost.c:31:32: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
if(abs(d_PrevPosQty) > abs(d_PosQty[i])){
^
calcPosAvgCost.c:31:32: note: use function 'fabs' instead
if(abs(d_PrevPosQty) > abs(d_PosQty[i])){
^~~
fabs
2 warnings generated.
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 init.c -o init.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 blotter.so calcPosAvgCost.o init.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-blotter/00new/blotter/libs
** R
** data
** demo
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package ‘quantmod’ was built under R version 3.6.2
Execution halted
ERROR: lazy loading failed for package ‘blotter’
removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/blotter’
Error: Failed to install 'blotter' from GitHub:
(converted from warning) installation of package ‘/var/folders/_8/zy8__ntx5cx0_lnbybvfjhsr0000gp/T//Rtmp0wtY3O/file25475cac4c09/blotter_0.14.8.tar.gz’ had non-zero exit status
I fixed the issue using Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE) from https://github.com/r-lib/remotes/issues/434

how do you use cygwin to compile an R package from source?

I am trying to install an R package from source:
https://sourceforge.net/projects/pdq-qnm-pkg/files/PDQ-R%20Source/6.1-1/pdq_6.1-1.tar.gz
I cannot install RTools to compile but I have Cygwin. How can install this package from source using Cygwin?
when I do this:
install.packages("pdq_6.1-1.tar.gz",repos=NULL,type="source")
I get this error:
Warning in install.packages :
installation of package ‘PDQ-6.2.0.tar.gz’ had non-zero exit status
Without knowing the failures, you can not solve the issue.
I assume you are missing some tools or libraries.
See http://kbroman.org/pkg_primer/pages/build.html
and try
R CMD INSTALL pdq_6.1-1.tar.gz
On my cygwin system with R-3.2.4
$ R CMD INSTALL pdq_6.1-1.tar.gz
* installing to library ‘/usr/lib/R/site-library’
* installing *source* package ‘pdq’ ...
** libs
gcc -I/usr/lib/R/include -DNDEBUG -D__R_PDQ -ggdb -O2 -pipe -Wimplicit-function-declaration -std=gnu99 -fdebug-prefix-map=/cygdrive/e/cyg_pub/devel/R/R-3.2.4-1.x86_64/build=/usr/src/debug/R-3.2.4-1 -fdebug-prefix-map=/cygdrive/e/cyg_pub/devel/R/R-3.2.4-1.x86_64/src/R-revised=/usr/src/debug/R-3.2.4-1 -c MVA_Approx.c -o MVA_Approx.o
[cut]
gcc -shared -L/usr/lib/R/lib -o pdq.dll MVA_Approx.o MVA_Canon.o MVA_Solve.o PDQ_Build.o PDQ_Exact.o PDQ_Globals.o PDQ_MServer.o PDQ_Report.o PDQ_Utils.o pdq.o -L/usr/lib/R/lib -lR -lintl -lpcre -llzma -lbz2 -lz -ltirpc -lrt -ldl -lm -liconv -licuuc -licui18n
installing to /usr/lib/R/site-library/pdq/libs
** R
** demo
** preparing package for lazy loading
Creating a generic function for ‘print’ from package ‘base’ in package ‘pdq’
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (pdq)

Resources