By Richie Cotton

2014-09-08 10:11:07 8 Comments

I tried to install a package, using


but received the warning

Warning message:
package 'foobarbaz' is not available (for R version x.y.z)

Why doesn't R think that the package is available?

See also these questions referring to specific instances of this problem:

My package doesn't work for R 2.15.2
package 'Rbbg' is not available (for R version 2.15.2)
package is not available (for R version 2.15.2)
package doMC NOT available for R version 3.0.0 warning in install.packages
Dependency ‘Rglpk’ is not available for package ‘fPortfolio’
What to do when a package is not available for our R version?
Is the bigvis package for R not available for R version 3.0.1?
package ‘syncwave’/‘mvcwt’ is not available (for R version 3.0.2)
package ‘diamonds’ is not available (for R version 3.0.0)
Is the plyr package for R not available for R version 3.0.2?
Package bigmemory not installing on R 64 3.0.2
package "makeR" is not available (for version 3.0.2)
package ‘RTN’ is not available (for R version 3.0.1)
Trouble Installing geoR package
package ‘twitterR’ is not available (for R version 3.1.0)
How to install 'Rcpp, package? I got "package is not available"
package ‘dataset’ is not available (for R version 3.1.1)
"package ‘rhipe’ is not available (for R version 3.1.2)"


@PaladiN 2018-09-07 03:38:32

This solution might break R but here is an easiest solution that works 99% of time.

You need to do is just:


As mentioned by the author over here

@thc 2018-09-14 17:47:15

Why is this answer downvoted?

@damjan 2018-06-25 17:45:03

I made the mistake of forgetting to put repos=NULL when installing the R package from source code. In this case the error message is slightly misleading: package 'foobarbaz' is not available (for R version x.y.z)

The problem was not the version of R, it was the repos parameter. I did install.packages('path/to/source/code/of/foobarbaz', type='source', repos=NULL) which worked for me in this occasion.

Hope this helps someone.

@Ajay B 2018-06-26 09:34:28

When I try install.packages('foobarbaz', repos=NULL) I get error " Error in install.packages("pair", repos = NULL) : type == "both" cannot be used with 'repos = NULL'"

@damjan 2018-07-28 14:56:46

Thanks for the comment - I think I forgot to write the type="source" parameter since I mentioned I installed this package from source code, I'll edit the answer.

@Richie Cotton 2014-09-08 10:11:56

1. You can't spell

The first thing to test is have you spelled the name of the package correctly? Package names are case sensitive in R.

2. You didn't look in the right repository

Next, you should check to see if the package is available. Type


See also ?setRepositories.

To see which repositories R will look in for your package, and optionally select some additional ones. At the very least, you will usually want CRAN to be selected, and CRAN (extras) if you use Windows, and the Bioc* repositories if you do any [gen/prote/metabol/transcript]omics biological analyses.

To permanently change this, add a line like setRepositories(ind = c(1:6, 8)) to your file.

3. The package is not in the repositories you selected

Return all the available packages using

ap <- available.packages()

See also Names of R's available packages, ?available.packages.

Since this is a large matrix, you may wish to use the data viewer to examine it. Alternatively, you can quickly check to see if the package is available by testing against the row names.

"foobarbaz" %in% rownames(ap)

Alternatively, the list of available packages can be seen in a browser for CRAN, CRAN (extras), Bioconductor, R-forge, RForge, and github.

Another possible warnings message you may get when interacting with CRAN mirrors is:

Warning: unable to access index for repository

Which may indicate the selected CRAN repository is currently be unavailable. You can select a different mirror with chooseCRANmirror() and try the installation again.

There are several reasons why a package may not be available.

4. You don't want a package

Perhaps you don't really want a package. It is common to be confused about the difference between a package and a library, or a package and a dataset.

A package is a standardized collection of material extending R, e.g. providing code, data, or documentation. A library is a place (directory) where R knows to find packages it can use

To see available datasets, type


5. R or Bioconductor is out of date

It may have a dependency on a more recent version of R (or one of the packages that it imports/depends upon does). Look at

ap["foobarbaz", "Depends"]

and consider updating your R installation to the current version. On Windows, this is most easily done via the installr package.


(Of course, you may need to install.packages("installr") first.)

Equivalently for Bioconductor packages, you may need to update your Bioconductor installation.


6. The package is out of date

It may have been archived (if it is no longer maintained and no longer passes R CMD check tests).

In this case, you can load an old version of the package using install_version()

install_version("foobarbaz", "0.1.2")

An alternative is to install from the github CRAN mirror.


7. There is no Windows/OS X/Linux binary

It may not have a Windows binary due to requiring additional software that CRAN does not have. Additionally, some packages are available only via the sources for some or all platforms. In this case, there may be a version in the CRAN (extras) repository (see setRepositories above).

If the package requires compiling code (e.g. C, C++, FORTRAN) then on Windows install Rtools or on OS X install the developer tools accompanying XCode, and install the source version of the package via:

install.packages("foobarbaz", type = "source")

# Or equivalently, for Bioconductor packages:
biocLite("foobarbaz", type = "source")

On CRAN, you can tell if you'll need special tools to build the package from source by looking at the NeedsCompilation flag in the description.

8. The package is on github/Bitbucket/Gitorious

It may have a repository on Github/Bitbucket/Gitorious. These packages require the remotes package to install.


(As with installr, you may need to install.packages("remotes") first.)

9. There is no source version of the package

Although the binary version of your package is available, the source version is not. You can turn off this check by setting

options(install.packages.check.source = "no")

as described in this SO answer by imanuelc and the Details section of ?install.packages.

10. The package is in a non-standard repository

Your package is in a non-standard repository (e.g. Rbbg). Assuming that it is reasonably compliant with CRAN standards, you can still download it using install.packages; you just have to specify the repository URL.

install.packages("Rbbg", repos = "")

RHIPE on the other hand isn't in a CRAN-like repository and has its own installation instructions.

@Richie Cotton 2014-09-08 10:42:58

@KonradRudolph View works in R GUI, Architect, Revo-R and Live-R too. Haven't tried in emacs/ESS.

@Konrad Rudolph 2014-09-08 12:35:12

Ah, my bad. I thought I’d checked and found that the function didn’t exist. It does of course (but it doesn’t work for me on OS X …).

@David Arenburg 2014-09-08 20:07:23

I Think it worth mentioning that installr works only on windows

@tonytonov 2014-09-10 06:59:06

Another possible reason: compilation fails due to missing dependencies (compiling from source under linux), e.g. as described here.

@Richie Cotton 2014-09-10 08:02:09

@tonytonov Since that is a different warning, it doesn't belong here. Feel free to write an alternative question about How should I deal with "installation of package 'xxx' had non-zero exit status" warning?.

@Richie Cotton 2014-12-14 05:15:17

@Gregor Yep, that's point number 5.

@Konrad Rudolph 2015-10-29 14:40:39

“It is common to be confused about the difference between a package and a library” — well, duh: The R developers themselves are confused about that. How else to explain the function library? However, in that vein, shouldn’t this answer mention/explain .libPaths? Unset or non-writeable library paths seems to be one of the most common problems when installing packages.

@Sergio Fernández 2015-12-29 12:47:06

I'd suggest including another point: Trying to install packages that comes inside r-core, like in this question, in which tries to install parallel package, when it is already in r-core

@Saba 2016-03-18 12:32:54

This is not always applicable. R is just acting funny with the 3+ versions. See my answer. I just set the download.file.method to wget and it worked like a charm. I am not sure why though, maybe someone can elaborate on that.

@jangorecki 2016-04-17 20:44:31

This is really nice answer, but it lacks the case described in @saby answer. The method argument in install.packages can fix that issue.

@Richie Cotton 2016-04-19 07:57:23

@saby When the download.file method argument is unsuitable, the warning is download had nonzero exit status, so that isn't quite applicable to this answer, but feel free to write a Q&A on that warning.

@Biboswan 2017-08-06 11:51:08

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 .

@nachti 2017-04-14 11:00:56

I had the same problem (on Linux) which could be solved changing the proxy settings. If you are behind a proxy server check the configuration using Sys.getenv("http_proxy") within R. In my ~/.Renviron I had the following lines (from causing the problem:


Changing it to

http_proxy="http://user:[email protected]:port"

solved the problem. You can do the same for https.

It was not the first thought when I read "package xxx is not available for r version-x-y-z" ...


@Clément F 2017-03-07 20:10:33

As mentioned here (in French), this can happen when you have two versions of R installed on your computer. Uninstall the oldest one, then try your package installation again! It worked fine for me.

@Tombart 2016-02-23 13:14:50

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"))

@Jack Wasey 2016-12-30 17:49:20

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.

@AlexG 2016-08-29 07:32:50

I fixed this error on Ubuntu by carefully following the instructions for installing R. This included:

  1. adding deb trusty/ to my /etc/apt/sources.list file
  2. Running sudo apt-get update
  3. Running sudo apt-get install r-base-dev

For step 1 you can chose any CRAN download mirror in place of my University of Toronto one if you would like.

@Belter 2017-04-27 05:51:42

This way do solved my problem, but still update my R to the newest version(from 3.02 to 3.4). If you want to update your R, this is a nice way.

@Saba 2016-03-18 12:25:18

There seems to be a problem with some versions of R and libcurl. I have had the same problem on Mac (R version 3.2.2) and Ubuntu (R version 3.0.2) and in both instances it was resolved simply by running this before the install.packages command

options(download.file.method = "wget")

The solution was suggested by a friend, however, I haven't been able to find it in any of the forums, hence submitting this answer for others.

@jangorecki 2016-04-17 20:41:52

for my setup, having curl apt installed in Ubuntu and old R 2.15.0, the install.packages(..., method="curl") did fix the problem

@garyrob 2016-06-20 19:47:32

This worked for me on OS X with R 3.2.2.

@Jeff 2016-08-18 18:55:42

I had to do method="curl" rather than wget, but it fixed the problem

@D. Woods 2016-08-26 04:24:45

install_version in devtools helped me get around this. My Mac didn't like wget either. (I had R 3.2.3 complaining about not being able to find an archive package using http://. Other packages were installing just fine)

@Darren Wilkinson 2016-10-09 17:22:17

This worked for me with an installation of R 3.2.2 on Ubuntu Linux 64 bit

@Dmitry 2016-03-03 03:45:26

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

@adempewolff 2016-04-04 09:59:58

Suspected that this was the case. It appears to be a bug in r-studio however. I just tested and I don't need to set the repository if I just launch R from the terminal--only from within r-studio.

@oski86 2016-04-13 09:59:16

This helped for R 3.2.2 as well, thanks @Dmitry

@Joseah 2017-07-24 06:22:02

Helped with version 3.4.0 as well, thanks!

@upendra 2018-09-20 17:59:06

Thanks. Helped with version 3.5.0 as well...

@user3386170 2018-12-20 15:01:21

And 3.5.1 as well. Before setting dependencies and repos, R wasn't able to connect to (and thus troubleshooting in other question didn't work). After, I could access that site even though packages are still not loading in the simple way.

@user3386170 2018-12-20 15:38:21

Also on my other computer that has version 3.5.0.

@BioProgram 2016-01-04 15:16:51

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


@Joris Meys 2017-06-20 15:08:39

That's only for bioconductor packages, and this is also the way bioconductor packages have to be installed.

@bli 2017-06-20 15:20:42

@JorisMeys It seems to me that all packages I tried to install so far were available via this method, but I'm mainly using R for bioinformatics.

@Joris Meys 2017-06-20 16:32:36

@bli ggplot2 is not, dplyr is not, randomForest is not, and the other 10,000 packages on CRAN are neither. biocLite is only for installing bioconductor packages.

@bli 2017-06-20 16:45:11

@JorisMeys I don't know how, but biocLite is able to transparently fetch these packages on cran and install them. I just tested for dplyr (on Xubuntu 16.04, if that matters). Hoping to avoid mess as much as possible, I now try to install all packages "the same way" (currently using biocLite).

@Joris Meys 2017-06-21 08:57:18

@bli you're right, I stand corrected. The code in biocLite recognizes the correct repos for the package and then calls install.packages() to do the actual installing. But it's not working because you use biocLite. It works because install.packages() does what it is supposed to do. There's no difference between using biocLite() and install.packages() other than the overhead and the fact that biocLite() by default also updates all other packages it deems necessary. So I'd still advise to use install.packages() for non-bioconductor packages.

@bli 2017-06-21 09:08:35

@JorisMeys I thought that biocLite ensured that package versions were compatible with all other packages installed this way. Does a direct install.packages() have the same guarantees?

@Joris Meys 2017-06-21 09:16:27

@bli it doesn't guarantee compatibility, it updates everything to the latest version (unless you put suppressUpdates = TRUE). This is the same as calling update.packages() and then install.packages(). Because that's literally what biocLite does under the hood.

@bli 2015-07-08 13:20:03

One thing that happened for me is that the version of R provided by my linux distribution (R version 3.0.2 provided by Ubuntu 14.04) was too old for the latest version of the package available on CRAN (in my case, plyr version 1.8.3 as of today). The solution was to use the packaging system of my distribution instead of trying to install from R (apt-get install r-cran-plyr got me version 1.8.1 of plyr). Maybe I could have tried to update R using updateR(), but I'm afraid that doing so would interfere with my distribution's package manager.

@Joris Meys 2017-06-20 15:07:50

For problems with Ubuntu, check the README:

@dardisco 2015-06-01 02:36:31

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)

@jangorecki 2016-04-17 18:28:46

Usually stated dependency on R version is there for a reason, it may be wise to check what such change will potentially break.

Related Questions

Sponsored Content

20 Answered Questions

[SOLVED] How do I find the location of my Python site-packages directory?

  • 2008-09-23 17:04:43
  • Daryl Spitzer
  • 709625 View
  • 785 Score
  • 20 Answer
  • Tags:   python installation

21 Answered Questions

[SOLVED] Find the version of an installed npm package

  • 2012-06-10 20:36:27
  • Laurent Couvidou
  • 949726 View
  • 1857 Score
  • 21 Answer
  • Tags:   node.js package npm

1 Answered Questions

[SOLVED] Installing "AED" package in R version 3.1.0

  • 2014-07-16 09:39:10
  • Silvia
  • 3735 View
  • 0 Score
  • 1 Answer
  • Tags:   r package

1 Answered Questions

[SOLVED] warning: package ‘grid’ is not available (for R version 3.1.2)

7 Answered Questions

[SOLVED] How do I install an R package from source?

4 Answered Questions

[SOLVED] Errors installing plyr / rcpp

  • 2014-06-07 10:33:45
  • rgalhama
  • 10522 View
  • 7 Score
  • 4 Answer
  • Tags:   r plyr rcpp

1 Answered Questions

[SOLVED] How do I install an older R package?

0 Answered Questions

package ‘plyr’ is not available (for R version 3.0.2)

  • 2016-03-31 03:15:28
  • Jie Liu
  • 998 View
  • 0 Score
  • 0 Answer
  • Tags:   r plyr

0 Answered Questions

Package "Kendall" in R- Version 3.1.1

  • 2015-03-18 17:28:37
  • Reetika Choudhary
  • 330 View
  • 0 Score
  • 0 Answer
  • Tags:   r

1 Answered Questions

[SOLVED] package ‘twitterR’ is not available (for R version 3.1.0)

  • 2014-04-15 15:39:04
  • user3465742
  • 4372 View
  • 0 Score
  • 1 Answer
  • Tags:   r

Sponsored Content