Why can't I install "forecast" package in RStudio?

17,032

Solution 1

The easiest fix to your problem would be to try selecting a different CRAN mirror for downloading and installing the forecast package. You can manually select a mirror by choosing:

Packages -> Set CRAN mirror...

I just ran install.packages("forecast") using the Singapore mirror (as I live there), and I had no problem.

If you must continue to use your current mirror, then you will have to figure out which dependencies cannot be downloaded and you must obtain them manually from somewhere.

Solution 2

I had the same problem . after the command :

install.packages("forecast_5.9.tgz")

appears warning: Warning in install.packages : package 'forecast_5.9.tgz' is not available (for R version 3.1.2)

the below command works

install.packages("forecast") 

also installed other related packages.

Best Swapnil

Share:
17,032
Sophie
Author by

Sophie

Updated on June 28, 2022

Comments

  • Sophie
    Sophie almost 2 years

    I was trying to install the "forecast" package and had trouble installing. I tried install.packages("forecast") and get this error message:

    *Installing package into ‘C:/Users/DT217/Documents/R/win-library/3.1’
    (as ‘lib’ is unspecified)
      有二进制版本(将被安装),但源代码版本是后来的:
             binary source
    forecast    5.8    5.9
    also installing the dependencies ‘zoo’, ‘RcppArmadillo’
    trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/zoo_1.7-11.zip'
    Warning in install.packages :
    cannot open: HTTP status was '404 Not Found'
    Error in download.file(url, destfile, method, mode = "wb", ...) : 
    cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/zoo_1.7-11.zip'
    Warning in install.packages :
    download of package ‘zoo’ failed
    trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/RcppArmadillo_0.4.600.4.0.zip'
    Warning in install.packages :
    cannot open: HTTP status was '404 Not Found'
    Error in download.file(url, destfile, method, mode = "wb", ...) : 
    cannot open URL'http://cran.rstudio.com/bin/windows/contrib/3.1/RcppArmadillo_0.4.600.4.0.zip'
    Warning in install.packages :
    download of package ‘RcppArmadillo’ failed
    trying URL'http://cran.rstudio.com/bin/windows/contrib/3.1/forecast_5.8.zip'
    Warning in install.packages :
    cannot open: HTTP status was '404 Not Found'
    Error in download.file(url, destfile, method, mode = "wb", ...) : 
    cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/forecast_5.8.zip'
    Warning in install.packages :
    download of package ‘forecast’ failed*
    

    I tried to open the URL given in the error and can't open it. I also tried installing "zoo" package and got similar error. However, I was able to install some other package, so some packages are working.

    Here are the info about the version of the RStudio I am using:

    $platform
    [1] "x86_64-w64-mingw32"
    $arch
    [1] "x86_64"
    $os
    [1] "mingw32"
    $system
    [1] "x86_64, mingw32"
    $status
    [1] ""
    $major
    [1] "3"
    $minor
    [1] "1.3"
    $year
    [1] "2015"
    $month
    [1] "03"
    $day
    [1] "09"
    $`svn rev`
    [1] "67962"
    $language
    [1] "R"
    $version.string
    [1] "R version 3.1.3 (2015-03-09)"
    $nickname
    [1] "Smooth Sidewalk"*
    

    Here's a post with similar questions. Any help would be greatly appreciated. Thank you in advance!

    Sophie