Skip to content

Package Dependency Resolution, Downloads and Installation

pkgdepends is a toolkit for package dependencies, downloads and installations, to be used in other packages. If you are looking for a package manager, see pak.


  • Look up package dependencies recursively.
  • Visualize package dependencies.
  • Download packages and their dependencies.
  • Install downloaded packages.
  • Includes a dependency solver to find a consistent set of dependencies.
  • Supports CRAN and Bioconductor packages automatically.
  • Supports packages on GitHub and GitLab.
  • Supports packages in git repositories.
  • Supports package bundles or files on the web.
  • Supports local package file and trees.
  • Supports the Remotes entry in the DESCRIPTION file.
  • Caches metadata and downloaded packages via pkgcache
  • Performs all downloads and HTTP queries concurrently.
  • Builds and installs packages in parallel.


Once on CRAN, install the package with:



Package references

A package reference (ref) specifies a location from which an R package can be obtained from. Examples:


See “Package references” for details.

Package dependencies

Dependencies of the development version of the cli package:

pd <- new_pkg_deps("r-lib/pkgcache")
##  Updated metadata database: 2.81 MB in 8 files.                                
##  Updating metadata database ... done                                           
## r-lib/pkgcache [new][bld][cmp][dl] (unknown size)                    
## ├─callr 3.7.3 [new][bld][dl] (97.81 kB)                                         
## │ ├─processx 3.8.2 [new][bld][cmp][dl] (163.56 kB)                              
## │ │ ├─ps 1.7.5 [new][bld][cmp][dl] (129.21 kB)                                  
## │ │ └─R6 2.5.1 [new][bld][dl] (63.42 kB)                                        
## │ └─R6                                                                          
## ├─cli 3.6.1 [new][bld][cmp][dl] (567.29 kB)                                     
## ├─curl 5.0.2 [new][bld][cmp][dl] (714.17 kB)                                    
## ├─filelock 1.0.2 [new][bld][cmp][dl] (12.38 kB)                                 
## ├─jsonlite 1.8.7 [new][bld][cmp][dl] (1.05 MB)                                  
## ├─prettyunits 1.1.1 [new][bld][dl] (10.37 kB)                                   
## ├─processx                                                                      
## ├─R6                                                                            
## └─rappdirs 0.3.3 [new][bld][cmp][dl] (12.29 kB)                                 
## Key:  [new] new | [dl] download | [bld] build | [cmp] compile                   

See the pkg_deps class for details.

Package downloads

Downloading all dependencies of a package:

pdl <- new_pkg_download_proposal("r-lib/cli")
##  Getting 1 pkg with unknown size                                               
##  Got cli (source) (767.55 kB)                                       

See the pkg_download_proposal class for details.

Package installation

Installing or updating a set of package:

lib <- tempfile()
pdi <- new_pkg_installation_proposal(
  config = list(library = lib)
##  Getting 1 pkg with unknown size                                               
##  Cached copy of cli (source) is the latest build                    
##  Packaging cli                                                      
##  Packaged cli (1.5s)                                                
##  Building cli                                                       
##  Built cli (14.5s)                                                  
##  Installed cli (github::r-lib/cli@641fe8c) (60ms)                   
##  Summary:   1 new  in 14.5s                                                    

Dependency resolution

pkg_deps, pkg_download_proposal and pkg_installation_proposal all resolve their dependencies recursively, to obtain information about all packages needed for the specified package references. See “Dependency resolution” for details.

The dependency solver

The dependency solver takes the resolution information, and works out the exact versions of each package that must be installed, such that version and other requirements are satisfied. See “The dependency solver” for details.

Installation plans

pkg_installation_proposal can create installation plans, and then also install them. It is also possible to import installation plans that were created by other tools. See “Installation plans” for details.


The details of pkg_deps, pkg_download_proposal and pkg_installation_proposal can be tuned with a list of configuration options. See “Configuration” for details.


  • pak – R package manager
  • pkgcache – Metadata and package cache
  • devtools – Tools for R package developers

Code of Conduct

Please note that the pkgdepends project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.


MIT (c) RStudio