Installing R package: Fixing package ‘xxx’ is not available (for R version x.y.z)” warning?

By Haktan Suren
Dec 6th, 2015
24 Comments
28633 Views

The default version of `install.packages` somehow stopped working for me on latest version of R. In fact this is regardless of the version of R. I remember having same problem with the older versions of R as well.

Here is the screen shot of the warning. if you are having similar problem, keep on reading.

Package is not available

Anyways, long story short, as everyone knows, if you want to install a package on R, you use:

install.packages('package-name')

And it asks you to pick a mirror repository to search the package in. If you are like me, picking the Cloud, you will soon realize, it will give you a misleading warning that the package is not available for your installed version of R. Well, this is not entirely true based on my experience.

I think not all the repositories include same packages (or versions) for some reason, that’s something I need to confirm it with R support team. If you select different mirror from previous step, and you are lucky enough, you might be able to install the package without any further problem/headache.

I usually use the following code to install package from R and it works 99% of the time.

install.packages('package-name',repos='http://cran.us.r-project.org')

There are several mirrors available you can try, simply change the repos field on the code above. Find the list of the mirrors here.

You still have problem installing the R package? See my other post here.

Feel free to share your experience, or the mirror works for you the best commenting below.

About the Author

Haktan Suren
- Webguru, Programmer, Web developer, and Father :)

24 Responses to “Installing R package: Fixing package ‘xxx’ is not available (for R version x.y.z)” warning?”

  1. […] of all, I highly recommend checking my other post if you are getting package ‘xxx’ is not available (for R version x.y.z)” […]

  2. leeza says:

    I am not being able to install plotly package,tried every method u given….what should i do to make it work.

  3. Michael says:

    This was very helpful, thank you!

  4. SP says:

    I tried install.packages(‘package-name’,repos=’http://cran.us.r-project.org’) but it didnt work, now I have a new warning Installing package into ‘/home/MYSELF/R/x86_64-pc-linux-gnu-library/3.2’
    (as ‘lib’ is unspecified)
    what does it mean the lib is unspecified

  5. Kunal says:

    THanks a lot

  6. Mahnoor Akmal says:

    I am also having problem in installing worldcloud and sentiment package in R. it gives an error.
    Warning in install.packages :
    package ‘worldcloud’ is not available (for R version 3.4.4)
    Warning in install.packages :
    package ‘sentiment’ is not available (for R version 3.4.4)
    what can I do in this regard?

  7. Mahnoor Akmal says:

    By trying this
    install.packages(‘package-name’,repos=’http://cran.us.r-project.org’)

    It gives me this error

    Warning in install.packages :
    unable to access index for repository http://cran.us.r-project.org/src/contrib:
    cannot open URL ‘http://cran.us.r-project.org/src/contrib/PACKAGES’
    Warning in install.packages :
    package ‘worldcloud’ is not available (for R version 3.4.4)
    Warning in install.packages :
    unable to access index for repository http://cran.us.r-project.org/bin/windows/contrib/3.4:
    cannot open URL ‘http://cran.us.r-project.org/bin/windows/contrib/3.4/PACKAGES’

  8. Caglayan says:

    Hi,

    I am having some kind of problem in R. I tried to install “varest” package however it looks unavaliable. Pls could you help me about this issue.

    Here is the problem that I have.

    > install.packages(‘varest’)
    Installing package into ‘C:/Users/user/Documents/R/win-library/3.5’
    (as ‘lib’ is unspecified)
    Warning in install.packages :
    package ‘varest’ is not available (for R version 3.5.1)

  9. Çağlayan says:

    Problem is solved. Thank you. I am really apricated.

  10. Shim says:

    package ‘deal’ is not available (for R version 3.5.1)

  11. Shim says:

    Hi, Suren!
    I’m studying “Bayesian Network Credit Scoring in R”!
    The code presented in related document uses libray “deal”.
    When I installed package for deal, the following error occured!
    Please help me!!!
    =========================================
    install.packages(‘deal’,repos=’http://cran.us.r-project.org’)
    Installing package into ‘C:/Users/admin/Documents/R/win-library/3.5’
    (as ‘lib’ is unspecified)
    Warning in install.packages :
    package ‘deal’ is not available (for R version 3.5.1)

  12. Suyav Saifi says:

    I tried to install the package lubridate. it show me below mentioned error
    > install.packages(“lubridate”)
    Warning in install.packages :
    unable to access index for repository https://cran.rstudio.com/src/contrib:
    cannot open URL ‘https://cran.rstudio.com/src/contrib/PACKAGES’
    Installing package into ‘C:/Users/DELL/Documents/R/win-library/3.4’
    (as ‘lib’ is unspecified)
    Warning in install.packages :
    unable to access index for repository https://cran.rstudio.com/src/contrib:
    cannot open URL ‘https://cran.rstudio.com/src/contrib/PACKAGES’
    Warning in install.packages :
    package ‘lubridate’ is not available (for R version 3.4.3)
    Warning in install.packages :
    unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.4:
    cannot open URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/PACKAGES’

  13. bala says:

    Hi Team,

    I am getting the error while installing forecast package as mention below.

    > install.packages(‘forecast’,repos=’http://cran.us.r-project.org’)
    Warning: unable to access index for repository http://cran.us.r-project.org/src/contrib:
    cannot open URL ‘http://cran.us.r-project.org/src/contrib/PACKAGES’
    Warning: unable to access index for repository http://cran.us.r-project.org/bin/windows/contrib/3.4:
    cannot open URL ‘http://cran.us.r-project.org/bin/windows/contrib/3.4/PACKAGES’
    Warning message:
    package ‘forecast’ is not available (for R version 3.4.1) .

Wrap your code in <code class="{language}"></code> tags to embed!

Leave a Reply

E-mail address is required for commenting. However, it won't be visible to other users.

Loading Facebook Comments ...
Loading Disqus Comments ...