How to Deal With "Package 'Xxx' Is Not Available (For R Version X.Y.Z)" Warning

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

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

setRepositories()

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 biological analyses.

To permanently change this, add a line like setRepositories(ind = c(1:6, 8)) to your Rprofile.site 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.

View(ap)
"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

data()

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.

library(installr)
updateR()

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

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

source("http://bioconductor.org/biocLite.R")
biocLite("BiocUpgrade")

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

library(remotes)
install_version("foobarbaz", "0.1.2")

An alternative is to install from the GitHub CRAN mirror.

library(remotes)
install_github("cran/foobarbaz")

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:
source("http://bioconductor.org/biocLite.R")
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.

library(remotes)
install_github("packageauthor/foobarbaz")
install_bitbucket("packageauthor/foobarbaz")
install_gitorious("packageauthor/foobarbaz")

(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 = "http://r.findata.org")

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

What to do when a package is not available for our R version?

Try something like:

packageurl <- "http://cran.r-project.org/src/contrib/Archive/XXXX/XXXX_A.B.C.tar.gz"
install.packages(packageurl, contriburl=NULL, type="source")

where XXXX is your package name and A.B.C is the version of the package (not R).

Installing a package in R throws package is not available (for R version 3.0.1)

Just adding the NAMESPACE file really helped.

Untar the package, then create a NAMESPACE file in the untarred package and write 'exportPattern(".")' save it. Then tar the package using "tar -zcf package.tar.gz package" and then try to install it. I tried with the command

install.packages("~/R/workspace/Spot.tar.gz", repos = NULL, type = "source", lib="~/R/x86_64-pc-linux-gnu-library/3.0")

and it gets installed with the follwing output:

* installing *source* package ‘Spot’ ...
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘Spot.Rnw’
** testing if installed package can be loaded
Warning: ignoring .First.lib() for package ‘Spot’
* DONE (Spot)

Thanks alot guyzz :)

ROCR package not available for R 3.4.4

If you cannot update your R (maybe the risk of disruption in your older R packages and codes), you can follow these steps:

  1. Download the tar.gz format from CRAN (https://cran.r-project.org/src/contrib/ROCR_1.0-11.tar.gz).
  2. Open the tar.gz file with your Archive Manager.
  3. Delete MD5 file to prevent checksum Errors.
  4. Open the DESCRIPTION file and change the line Depends: R (>= 3.6) to Depends: R (>= 3.1).
  5. Save the modified DESCRIPTION and update your tar.gz file.
  6. Open RSTUDIO and use the install button from Packages tab. Package Archive File (.tar.gz) in the Install From dropdown menu and find the modified tar.gz
    from browse, and push install button. Or simply use install.packages("~/ROCR_1.0-11.tar.gz", repos = NULL, type = "source") .

Although almost always it works fine, you should know without an MD5 checksum you risk yourself with security issues. However, we can almost always trust CRAN packages.

Error while downloading highcharter package in r

The problem: Outdated R version

The latest version of rjson (0.2.21) depends on R version >= 4.0.0 (see CRAN), and it seems like you have R version 3.6.3.

Best solution: Update R

Your best option is to update your version of R before installing rjson or highcharter.

Alternatives: Install old version of rjson

An alternative is to install an older version of rjson (0.2.20 should work with your version of R).

You can either do this with packages like renv:

renv::install("rjson@0.2.20")

Or remotes:

remotes::install_version("rjson", "0.2.20")

Or you could download it and install it manually from this mran snapshot.



Related Topics



Leave a reply



Submit