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
Related
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.
I am trying desperately to install package png into R on MacOS Big Sur 11.3 .
Unfortunately, I have issue with libz.1.dylib : it seems that installation doesn't find it.
However, I have copied from /opt/local/lib/libz.1.dylib to /usr/lib and /usr/local/lib directories with DYLD_LIBRARY_PATH set correctly to them.
Here the output of installation :
> install.packages('png')
Installing package into ‘/usr/local/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.irsn.fr/src/contrib/png_0.1-7.tar.gz'
Content type 'application/x-gzip' length 24990 bytes (24 KB)
==================================================
downloaded 24 KB
* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc-9 -I"/usr/local/Cellar/r/4.1.1/lib/R/include" -DNDEBUG -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/xz/include -I/usr/local/include `libpng-config --cflags` -fPIC -mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib -c read.c -o read.o
...
gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/4.1.1/lib/R/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/xz/lib -L/usr/local/lib -o png.so read.o write.o -L/opt/intel/oneapi/intelpython/latest/lib -lpng16 -lz -L/usr/local/Cellar/r/4.1.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘png’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so':
dlopen(/usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so, 6): Library not loaded: #rpath/libz.1.dylib
Referenced from: /usr/local/lib/R/4.1/site-library/00LOCK-png/00new/png/libs/png.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/4.1/site-library/png’
The downloaded source packages are in
‘/private/tmp/Rtmp9boK6h/downloaded_packages’
Warning message:
In install.packages("png") :
installation of package ‘png’ had non-zero exit status
My file ~/.R/Makevars is :
VER=-9
CC=gcc$(VER)
CXX=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion -L/opt/local/lib
FLIBS=-L/usr/local/Cellar/gcc#9/9.4.0/lib/gcc/9 -L/opt/local/lib
PKG_LIBS=$(PNG_LIBS) `libpng-config --static --ldflags`
PKG_CFLAGS=$(PNG_CFLAGS) `libpng-config --cflags`
How could I circumvent this issue ?
I'm trying to install one R package with MacOSX with the command:
install_github("yuanzhongshang/PMR")
But there is an error:
Downloading GitHub repo yuanzhongshang/PMR#HEAD
✓ checking for file
─ preparing ‘PMR’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ installing the package to process help pages
-----------------------------------
─ installing *source* package ‘PMR’ ...
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppArmadillo/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fopenmp -fPIC -Wall -g -O2 -Wall -pedantic -fdiagnostics-color=always -c EstimateVC_1.cpp -o EstimateVC_1.o
clang: error: unsupported option '-fopenmp'
make: *** [EstimateVC_1.o] Error 1
ERROR: compilation failed for package ‘PMR’
─ removing
How can I solve it?
Since the new update of R on my Mac (version 11.2.2), I can't download any package.
Well, I can, but it is placed inside a "private" folder, while it's specified that it should be in my Library.
For instance, when I want to download 'mapsf' it gives me this error:
Installing package into ‘/Users/elifka/Library/R/3.6/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘mapsf’
Do you want to attempt to install these from sources? (Yes/no/cancel) y
installing the source package ‘mapsf’
trying URL 'http://cran.rstudio.com/src/contrib/mapsf_0.1.1.tar.gz'
Content type 'application/x-gzip' length 2904481 bytes (2.8 MB)
==================================================
downloaded 2.8 MB
* installing *source* package ‘mapsf’ ...
** package ‘mapsf’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c RcppExports.cpp -o RcppExports.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c init.c -o init.o
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/include" -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c layout.cpp -o layout.o
clang++ -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib /Library/Frameworks/R.framework/Resources/lib/libc++abi.1.dylib -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mapsf.so RcppExports.o init.o layout.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: framework not found CoreFoundation
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mapsf.so] Error 1
ERROR: compilation failed for package ‘mapsf’
* removing ‘/Users/elifka/Library/R/3.6/library/mapsf’
Warning in install.packages :
installation of package ‘mapsf’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/h3/vt0n6y2534b35ss3dzf_037m0000gn/T/RtmpV1gjTe/downloaded_packages’
I tried to put type='binary'in the install.packages() as it was suggested in another post, butit did not do the work.
I also tried to put 'no' for compilation and it did not work neither.
Cheers,
Ok so I fixed it by deleting R Studio and R and reinstalling both.
Deleting R Studio and R and reinstalling both worked form me too
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