Errors installing 'forecast' package in R version 3.3.2 - r

Trying to install 'forecast' package in R version 3.3.2 on MacOS Sierra as follows:
install.packages("forecast")
Getting a slew of errors I don't understand. First it downloads all dependency packages from http://cloud.r-project.org. First error I get is this:
* installing *source* package ‘quadprog’ ...
** package ‘quadprog’ successfully unpacked and MD5 sums checked
** libs
gfortran -arch x86_64 -fPIC -g -O2 -c aind.f -o aind.o
make: gfortran: No such file or directory
make: *** [aind.o] Error 1
ERROR: compilation failed for package ‘quadprog’
* removing ‘/Users/ekorne201/Library/R/3.3/library/quadprog’
It then moves on to:
* installing *source* package ‘fracdiff’ ...
** package ‘fracdiff’ successfully unpacked and MD5 sums checked
After which it says:
ld: warning: directory not found for option '-L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [fracdiff.so] Error 1
ERROR: compilation failed for package ‘fracdiff’
* removing ‘/Users/ekorne201/Library/R/3.3/library/fracdiff’
Goes through the same thing for 'lmtest' and 'RcppArmadillo', after which it ends with:
ERROR: dependencies ‘tseries’, ‘fracdiff’, ‘lmtest’, ‘RcppArmadillo’ are not available for package ‘forecast’
* removing ‘/Users/ekorne201/Library/R/3.3/library/forecast’
The downloaded source packages are in
‘/private/var/folders/8p/54qnlb9x7bj8syz631_d58t92rmkyp/T/Rtmp246ipQ/downloaded_packages’
Warning messages:
1: In install.packages("forecast") :
installation of package ‘quadprog’ had non-zero exit status
2: In install.packages("forecast") :
installation of package ‘fracdiff’ had non-zero exit status
3: In install.packages("forecast") :
installation of package ‘lmtest’ had non-zero exit status
4: In install.packages("forecast") :
installation of package ‘RcppArmadillo’ had non-zero exit status
5: In install.packages("forecast") :
installation of package ‘tseries’ had non-zero exit status
6: In install.packages("forecast") :
installation of package ‘forecast’ had non-zero exit status
Stuck on how to proceed and would appreciate the advice.

I got the same error. I solved it by installing the gfortran. In macOS, I can do it such that
brew install gcc
and in R such that
install.packages("forecast")
so
> library(forecast); fit <- tbats(UScitiesD);
> fit
BATS(0.566, {0,2}, -, -)
Call: tbats(y = UScitiesD)
Parameters
Lambda: 0.565592
Alpha: 0.2166945
MA coefficients: -0.130506 -0.511551
Seed States:
[,1]
[1,] 90.10291
[2,] 0.00000
[3,] 0.00000
Sigma: 27.61468
AIC: 761.9238
As mentioned in comments, other method is to install it from here.
Related
Does installing gfortran with homebrew and with an installer create a conflict?

Related

R installing package 'DescTools' - "gfortran no file or directory" error

I've tried to download the package "DescTools" and I'm getting an error message while installing the dependencies ('lmom', 'gld') which I cannot solve myself. It seems like "gfortran" is the problem, I've googled it but didn't get what to do.
I've get the error code below, would appreciate if anyone could help. Working on Mac OS X.
Thanks!
> install.packages("DescTools")
> Installing package into ‘/Users/XXX/Library/R/4.0/library’
> (as ‘lib’ is unspecified)
> also installing the dependencies ‘lmom’, ‘gld’
> There are binary versions available but the source versions are later:
> binary source needs_compilation
> lmom 2.8 2.9 TRUE
> gld 2.6.4 2.6.6 TRUE
> DescTools 0.99.44 0.99.47 TRUE
Do you want to install from sources the packages which need compilation? (Yes/no/cancel) Yes
installing the source packages ‘lmom’, ‘gld’, ‘DescTools’
installing *source* package ‘lmom’ ...
\*\* package ‘lmom’ successfully unpacked and MD5 sums checked
\*\* using staged installation
\*\* libs
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c d1mach.f -o d1mach.o
make: gfortran: No such file or directory
make: \*\*\* \[d1mach.o\] Error 1
ERROR: compilation failed for package ‘lmom’
removing ‘/Users/XXX/Library/R/4.0/library/lmom’
Warning in install.packages :
installation of package ‘lmom’ had non-zero exit status
ERROR: dependency ‘lmom’ is not available for package ‘gld’
removing ‘/Users/XXX/Library/R/4.0/library/gld’
Warning in install.packages :
installation of package ‘gld’ had non-zero exit status
ERROR: dependency ‘gld’ is not available for package ‘DescTools’
removing ‘/Users/XXX/Library/R/4.0/library/DescTools’
Warning in install.packages :
installation of package ‘DescTools’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/fr/3xrgrwbd44vf58dqqtcml67h0000gn/T/RtmpOmArkk/downloaded_packages’

r can't install rstan r version 4.1.0 ubuntu 20.04.2

I'm having trouble installing rstan in R. I've tried using install.packages() (and the package installer) and get the following error:
/home/linuxbrew/.linuxbrew/bin/ld: cannot find -llapack
/home/linuxbrew/.linuxbrew/bin/ld: cannot find -lblas
/home/linuxbrew/.linuxbrew/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/home/dave/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen’
Warning in install.packages :
installation of package ‘RcppEigen’ had non-zero exit status
ERROR: dependency ‘RcppEigen’ is not available for package ‘StanHeaders’
* removing ‘/home/dave/R/x86_64-pc-linux-gnu-library/4.1/StanHeaders’
Warning in install.packages :
installation of package ‘StanHeaders’ had non-zero exit status
ERROR: dependencies ‘StanHeaders’, ‘RcppEigen’ are not available for package ‘rstan’
* removing ‘/home/dave/R/x86_64-pc-linux-gnu-library/4.1/rstan’
Warning in install.packages:
installation of package ‘rstan’ had non-zero exit status

Issues with installing caret package of R in archlinux

I am trying to install the package caret in R for sometime now, and I am getting this error message:
*installing *source* package ‘minqa’ ...
** package ‘minqa’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -g -O2 -c altmov.f -o altmov.o
make: gfortran: Command not found
make: *** [altmov.o] Error 127
/usr/lib64/R/etc/Makeconf:155: recipe for target 'altmov.o' failed
ERROR: compilation failed for package ‘minqa’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/minqa’
Warning in install.packages :
installation of package ‘minqa’ had non-zero exit status
* installing *source* package ‘SparseM’ ...
** package ‘SparseM’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -g -O2 -c bckslv.f -o bckslv.o
make: gfortran: Command not found
/usr/lib64/R/etc/Makeconf:155: recipe for target 'bckslv.o' failed
make: *** [bckslv.o] Error 127
ERROR: compilation failed for package ‘SparseM’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/SparseM’
Warning in install.packages :
installation of package ‘SparseM’ had non-zero exit status
ERROR: dependency ‘minqa’ is not available for package ‘lme4’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/lme4’
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
ERROR: dependency ‘SparseM’ is not available for package ‘quantreg’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/quantreg’
Warning in install.packages :
installation of package ‘quantreg’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/pbkrtest’
Warning in install.packages :
installation of package ‘pbkrtest’ had non-zero exit status
ERROR: dependencies ‘pbkrtest’, ‘quantreg’ are not available for package ‘car’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/car’
Warning in install.packages :
installation of package ‘car’ had non-zero exit status
ERROR: dependency ‘car’ is not available for package ‘caret’
* removing ‘/home/mohammad/R/x86_64-pc-linux-gnu-library/3.3/caret’
Warning in install.packages :
installation of package ‘caret’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpVBZAgE/downloaded_packages’
Now according to some of the post, I tried to install minqa,SparseM, lme4,car ... separately. Its not installing properly. The main problem that I suspect is the absence of gfortran library in my archlinux. I tried to find the package gfortran in arch repository using pacman. It is not present there, so in the end I am just stuck. Does anybody has a solution or faced this problem before. Thanks.
I had a similar problem. For anyone else with this problem this is the package you need to install. It is gcc-fortran 6.2.1-1
To install it:
sudo pacman -S gcc-fortran
https://www.archlinux.org/packages/core/x86_64/gcc-fortran/

Error when installing gpclib

R version 3.2.1
I downloaded gpclib_1.5-5.tar.gz from http://cran.r-project.org/web/packages/gpclib/index.html and attempted to install the package with
install.packages("D:/GIS/gpclib_1.5-5.tar.gz", repos = NULL, type = "source")
I get the error
* installing *source* package 'gpclib' ...
** package 'gpclib' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "D:/R/R-3.2.1/etc/i386/Makeconf" -f "D:/R/R-3.2.1/share/make/winshlib.mk" SHLIB="gpclib.dll" OBJECTS="Rgpc.o gpc.o"' had status 127
ERROR: compilation failed for package 'gpclib'
* removing 'D:/R/R-3.2.1/library/gpclib'
Warning in install.packages :
running command '"D:/R/R-3.2.1/bin/x64/R" CMD INSTALL -l "D:\R\R-3.2.1\library" "D:/GIS/gpclib_1.5-5.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘D:/GIS/gpclib_1.5-5.tar.gz’ had non-zero exit status
How do I troubleshoot this?
Extra Information
I am ultimately trying to create heat maps, and am following this tutorial
http://spatialanalysis.co.uk/wp-content/uploads/2013/04/james_cheshire_ggplot_intro_blog.pdf
You'll need to install Rtools to install the R compiler libraries:
http://cran.r-project.org/bin/windows/Rtools/
Otherwise, R will have issues compiling from source code.

Error in installing package hydroTSM on Mac OS X 10.9.5 - R (version 3.1.2)

I have searched for hints to my problem and made some progress through hints from similar posts, but ultimately still stuck. I am trying to install the package hydroTSM on a Mac (OS X 10.9.5). Using R Studio I successfully installed and loaded the most recent zoo and xts packages (dependencies). I tried:
install.packages("hydroTSM", lib="/Library/Frameworks/R.framework/Versions/3.1/Resources/library", type="source")
and it the install seems to proceed Ok until it gets to installing the rgeos package, and I get:
* installing *source* package ‘rgeos’ ...
** package ‘rgeos’ successfully unpacked and MD5 sums checked
configure: CC: clang
configure: CXX: clang++
configure: rgeos: 0.3-4
checking for /usr/bin/svnversion... yes
configure: svn revision: 460
checking geos-config usability...
./configure: line 2056: geos-config: command not found
no
configure: error: geos-config not usable
ERROR: configuration failed for package ‘rgeos’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rgeos’
Warning in install.packages :
installation of package ‘rgeos’ had non-zero exit status
ERROR: dependency ‘rgeos’ is not available for package ‘spacetime’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/spacetime’
Warning in install.packages :
installation of package ‘spacetime’ had non-zero exit status
ERROR: dependency ‘spacetime’ is not available for package ‘gstat’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/gstat’
Warning in install.packages :
installation of package ‘gstat’ had non-zero exit status
ERROR: dependency ‘gstat’ is not available for package ‘automap’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/automap’
Warning in install.packages :
installation of package ‘automap’ had non-zero exit status
ERROR: dependencies ‘gstat’, ‘automap’ are not available for package ‘hydroTSM’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/hydroTSM’
Warning in install.packages :
installation of package ‘hydroTSM’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/87/wn7lf03j7w39zjtnslph4lj80000gn/T/RtmpZ7UFC7/downloaded_packages’ "
Any suggestions greatly appreciated.

Resources