Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install forecast package of R in ubuntu 12.04?

I tried the following code for installation

>install.packages("forecast")

The error occurs like:

ERROR: dependency ‘Rcpp’ is not available for package ‘RcppArmadillo’
* removing ‘/root/R/x86_64-pc-linux-gnu-library/2.14/RcppArmadillo’
ERROR: dependencies ‘Rcpp’, ‘RcppArmadillo’ are not available for package ‘forecast’
* removing ‘/root/R/x86_64-pc-linux-gnu-library/2.14/forecast’

The downloaded packages are in
‘/tmp/RtmpJqQfrh/downloaded_packages’
Warning messages:
1: In install.packages("forecast") :
installation of package ‘RcppArmadillo’ had non-zero exit status
2: In install.packages("forecast") :
installation of package ‘forecast’ had non-zero exit status
like image 735
Saurabh Avatar asked Feb 14 '13 07:02

Saurabh


3 Answers

Your R version is too old for the current versions of the packages which forecast depends upon.

You can try manually installing an older version of the forecast package by downloading from its Archive/ section on CRAN. A good bet would a version of about the same age as your R installation.

If you upgrade R to a current version, the Rcpp, RcppArmadillo, ... all install fine, and so will the newest version of forecast. As you are on Ubuntu, it is actually extremely easy to get these newer version, just read the README here and add the apt repository information as described.

like image 61
Dirk Eddelbuettel Avatar answered Nov 06 '22 16:11

Dirk Eddelbuettel


I resolved my problem as: First of all I have add the my CRAN to the /etc/apt/sources.list. After that I executed the following command from my terminal

sudo apt-get update

and then

sudo apt-get upgrade

Once the upgradation done successful the in R console give the command

install.packages("forecast")

This has resolved my problem. For details information regarding this you can visit cran.r-project.org/bin/linux/ubuntu.

And I thanks to Dirk Eddelbuettel for his kind suggestions.

like image 40
Saurabh Avatar answered Nov 06 '22 16:11

Saurabh


If updating CRAN doesn't work, you might be missing gcc-fortran. This is needed for quadprog, which is needed for timeseries which in turn is needed for the CRAN forecast package.

To install the gcc-fortran package on Arch Linux, execute:

# pacman -S gcc-fortran

To install the fortran compiler on Ubuntu, execute:

# apt-get install gfortran
like image 2
Smile4ever Avatar answered Nov 06 '22 17:11

Smile4ever