I tried to install a package, using
install.packages("foobarbaz")
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)"
This question is related to
r
installation
repository
package
r-faq
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.
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='http://cran.rstudio.com/')
Found solution in other question
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 .
Another reason + solution
I run into this error ("package XXX is not available for R version X.X.X") when trying to install pkgdown in my RStudio on my company's HPC.
Turns out, the CRAN snapshot they have on the HPC is from Jan. 2018 (almost 2 years old) and indeed pkgdown did not exist then. That was meant to control the source of packages for layman users, but as a developer, you can in most cases change that by:
## checking the specific repos you currently have
getOption("repos")
## updating your CRAN snapshot to a newer date
r <- getOption("repos")
r["newCRAN"] <- "https://cran.microsoft.com/snapshot/*2019-11-07*/"
options(repos = r)
## add newCRAN to repos you can use
setRepositories()
If you know what you are doing and may need more than one package that might not be available in your system's CRAN, you can set this up in your project .Rprofile
.
If it's just one package, maybe just use install.packages("package name", repos = "a newer CRAN than your company's archaic CRAN snapshot")
.
I found a slight variation on #6 package is out of date from the excellent solution by @Richie Cotton.
Sometimes the package maintainer may show R version gaps that it does not support. In that case, you have at least two options: 1) upgrade your R version to the next one the target package already supports, 2) install the most recent version from the older ones available that would work with your R version.
A concrete example: the latest CRAN version of package rattle
for data mining, 5.3.0, does not support R version 3.4 because it had a big update between package versions 5.2.0 (R >= 2.13.0) and 5.3.0 (R >=3.5).
In a case like this, the alternative to upgrading the R installation is the solution already mentioned. Install the package devtools
if you don't have it (it includes package remotes
) and then install the specific version that will work in your current R. You can look up that information on the CRAN page for the specific package archives.
library("devtools")
install_version("rattle", version = "5.2.0", repos = "http://cran.us.r-project.org")
Another minor addition, while trying to test for an old R version using the docker image rocker/r-ver:3.1.0
repos
setting is MRAN
and this fails to get many packages.https
, so, for example:
install.packages("knitr", repos = "https://cran.rstudio.com")
seems to work.In my case the solution was to simply upgrade R.
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.
Ctrl
+ F
install.packages("https://cran.r-project.org/src/contrib/Archive/[NAME OF PACKAGE]/[VERSION NUMBER].tar.gz", repos = NULL, type="source")
"In some cases, you need to install several packages in advance to use the package you want to use.
For example, I needed to install 7 packages(Sejong
, hash
, rJava
, tau
, RSQLite
, devtools
, stringr
) to install KoNLP
package.
install.packages('Sejong')
install.packages('hash')
install.packages('rJava')
install.packages('tau')
install.packages('RSQLite')
install.packages('devtools')
install.packages('stringr')
library(Sejong)
library(hash)
library(rJava)
library(tau)
library(RSQLite)
library(devtools)
library(stringr)
install.packages("https://cran.r-project.org/src/contrib/Archive/KoNLP/KoNLP_0.80.2.tar.gz", repos = NULL, type="source")
library(KoNLP)
11. R (or another dependency) is out of date and you don't want to update it.
Warning this is not exactly best practice.
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)
It almost always works for me when I use bioconductor as source and then invoke biocLite. Example:
source("https://bioconductor.org/biocLite.R")
biocLite("preprocessCore")
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 https://support.rstudio.com/hc/en-us/articles/200488488-Configuring-R-to-Use-an-HTTP-or-HTTPS-Proxy) causing the problem:
http_proxy=https://proxy.dom.com:port
http_proxy_user=user:passwd
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" ...
HTH
This solution might break R but here is an easiest solution that works 99% of time.
You need to do is just:
install.packages('package-name',repos='http://cran.us.r-project.org')
As mentioned by the author over here
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.
I fixed this error on Ubuntu by carefully following the instructions for installing R. This included:
deb http://cran.utstat.utoronto.ca/bin/linux/ubuntu trusty/
to my /etc/apt/sources.list file sudo apt-get update
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.
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.
Edit (04/08/2020): I recently had an issue with a package (XML) reportedly not available for my R version (3.6.3, latest supported on Debian stretch), after an update of the package in CRAN. It was very unexpected because I already had installed it with success before (on the same version of R and same OS).
For some reason, the package was still there, but install.packages
was only looking at the updated (and incompatible) version. The solution was to find the URL of the compatible version and force install.packages
to use it, as follows:
install.packages("https://cran.r-project.org/src/contrib/Archive/XML/XML_3.99-0.3.tar.gz", repos=NULL, type="source", ask=FALSE)
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 https://cran.rstudio.com/
:
packages <- function(pkg){
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
if (length(new.pkg))
install.packages(new.pkg, dependencies = TRUE, repos='https://cran.rstudio.com/')
sapply(pkg, require, character.only = TRUE)
}
packages(c("foo", "bar", "baz"))
Source: Stackoverflow.com