I try to install R packages by using devtools (for specific version) but got some errors.
I have to install packages that’s specific version and use specific R version (4.1.*) plz.
R, devtools version
Install packages
- forecast : 8.13
- kernlab : 0.9-29
Install commands
install_version("forecast", version = "8.13")
install_version("kernlab", version = "0.9-29")
or add option dependencies=TRUE
Error list
cc -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 -O2 -fdebug-prefix-ma
p=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-s
ecurity -Wdate-time -D_FORTIFY_SOURCE=2 -g -c registerDynamicSymbol.c -o registerDynami
cSymbol.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcp
p/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O2 -fde
bug-prefix-map=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -We
rror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c updateMatrices.cpp -o update
Matrices.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcp
p/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O2 -fde
bug-prefix-map=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -We
rror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c updateTBATSMatrices.cpp -o u
pdateTBATSMatrices.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o forec
ast.so calcBATS.o calcTBATS.o etsTargetFunction.o etsTargetFunctionWrapper.o etscalc.o e
tspolyroot.o makeBATSMatrices.o makeTBATSMatrices.o registerDynamicSymbol.o updateMatric
es.o updateTBATSMatrices.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -l
R
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:10: recipe for target 'forecast.so' failed
make: *** [forecast.so] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/usr/local/lib/R/site-library/forecast’
경고메시지(들):
i.p(...)에서:
installation of package ‘/tmp/RtmpGgApec/remotes25555374bfb7/forecast’ had non-zero ex
it status
Commands I’ve tried
sudo apt-get install g++
sudo apt install gfortran
sudo apt install libcurl4-gnutls-dev
R version upgrade 4.1.0 -> 4.1.3
R version downgrade 4.1.3 -> 4.1.0
install.packages('forecast')
install.packages('kernlab')
2
Answers
In general when libraries are missing, "cannot find -lXXX", you should
apt-cache search libXXX
+-dev
, andapt-get install
what you find.So in this case:
A related answer.
Short answer: We supply a package with the most common dependencies so consider doing
sudo apt-get install r-base-dev
. After that you can compile.Longer answer: Ubuntu contains a number of pre-built CRAN packages. Consider doing
sudo apt install r-cran-kernlab r-cran-forecast
. For an older Ubuntu release this may reflect older versions.Best answer (if you are on Ubuntu 20.04 or 22.04): Consider r2u which has all (!!) of the CRAN packages as
r-cran-binaries
, and usesbspm
so that you can just sayinstall.packages(c("kernlab", "forecast"))
and still get everything pre-made as binaries, with dependencies, and managed viaapt
. But we do not support 18.04 for that.