How should I deal with “package 'xxx' is not available (for R version x.y.z)” warning?


In the latest R (3.2.3) there is a bug, preventing it some times from finding correct package. The workaround is to set repository manually:

install.packages("lubridate", dependencies=TRUE, repos='')

Found solution in other question


11. R (or another dependency) is out of date and you don't want to update it.

Warning this is not exactly best practice.

  • Download the package source.
  • Navigate to the DESCRIPTION file.
  • Remove the offending line with your text editor e.g.

    Depends: R (>= 3.1.1)
  • Install from local (i.e. from the parent directory of DESCRIPTION) e.g.

    install.packages("foo", type="source", repos=NULL)

Another minor addition, while trying to test for an old R version using the docker image rocker/r-ver:3.1.0

  1. The default repos setting is MRAN and this fails to get many packages.
  2. That version of R doesn't have https, so, for example: install.packages("knitr", repos = "") seems to work.

It almost always works for me when I use bioconductor as source and then invoke biocLite. Example:


This is what I finally could do for installing psych package in R-3.4.1 when I got the same warning

1:Googled for that package.

2:downloaded it manually having tar.gz extension

3:Chose the option "Package Archive File (.zip;.tar.gz)" for install packages in R

4:browsed locally to the place where it was downloaded and clicked install

You may get a warning: dependencies 'xyz' not available for the package ,then first install those from the repository and then do steps 3-4 .

This saved me a lot of time debugging what's wrong. In many cases are just mirrors out of date. This function can install multiple packages with their dependencies using

packages <- function(pkg){
    new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
    if (length(new.pkg))
        install.packages(new.pkg, dependencies = TRUE, repos='')
    sapply(pkg, require, character.only = TRUE)

packages(c("foo", "bar", "baz"))