Title: | Another Approach to Package Installation |
---|---|
Description: | The goal of 'pak' is to make package installation faster and more reliable. In particular, it performs all HTTP operations in parallel, so metadata resolution and package downloads are fast. Metadata and package files are cached on the local disk as well. 'pak' has a dependency solver, so it finds version conflicts before performing the installation. This version of 'pak' supports CRAN, 'Bioconductor' and 'GitHub' packages as well. |
Authors: | Gábor Csárdi [aut, cre], Jim Hester [aut], Posit Software, PBC [cph, fnd], Winston Chang [ctb] (R6, callr, processx), Ascent Digital Services [cph, fnd] (callr, processx), Hadley Wickham [ctb, cph] (cli, curl, pkgbuild), Jeroen Ooms [ctb] (curl, jsonlite), Maëlle Salmon [ctb] (desc, pkgsearch), Duncan Temple Lang [ctb] (jsonlite), Lloyd Hilaiel [cph] (jsonlite), Michel Berkelaar and lpSolve authors [ctb] (lpSolve), R Consortium [fnd] (pkgsearch), Jay Loden [ctb] (ps), Dave Daeschler [ctb] (ps), Giampaolo Rodola [ctb] (ps), Kuba Podgórski [ctb] (zip), Rich Geldreich [ctb] (zip) |
Maintainer: | Gábor Csárdi <[email protected]> |
License: | GPL-3 |
Version: | 0.8.0.9000 |
Built: | 2024-12-18 23:20:12 UTC |
Source: | https://github.com/r-lib/pak |
Various utilities to inspect and clean the package cache. See the pkgcache package if you need for control over the package cache.
cache_summary() cache_list(...) cache_delete(...) cache_clean()
cache_summary() cache_list(...) cache_delete(...) cache_clean()
... |
For |
cache_summary()
returns a summary of the package cache.
cache_list()
lists all (by default), or a subset of
packages in the package cache.
cache_delete()
deletes files from the cache.
cache_clean()
deletes all files from the cache.
cache_summary()
returns a list with elements:
cachepath
: absolute path to the package cache
files
: number of files (packages) in the cache
size
: total size of package cache in bytes
cache_list()
returns a data frame with the data about the cache.
cache_delete()
returns nothing.
cache_clean()
returns nothing.
cache_summary()
#> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/pkg" #> #> $files #> [1] 483 #> #> $size #> [1] 654662486 #>
cache_list()
#> # A data frame: 483 × 11 #> fullpath path package url etag sha256 version platf…¹ built #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> #> 1 /Users/gaborc… arch… NA http… "\"1… 0c8f0… NA NA NA #> 2 /Users/gaborc… bin/… evalua… http… "\"1… 08a39… 0.17 aarch6… NA #> 3 /Users/gaborc… bin/… crayon http… "\"2… 1e6d5… 1.5.2 aarch6… NA #> 4 /Users/gaborc… bin/… common… http… "\"4… 47b4a… 1.8.1 aarch6… NA #> 5 /Users/gaborc… bin/… curl http… "\"b… 7b8ba… 4.3.3 aarch6… NA #> 6 /Users/gaborc… bin/… tinytex http… "\"2… 7e9ba… 0.42 aarch6… NA #> 7 /Users/gaborc… bin/… jsonli… http… "\"1… 68e59… 1.8.2 aarch6… NA #> 8 /Users/gaborc… bin/… lifecy… http… "\"1… 7ce27… 1.0.3 aarch6… NA #> 9 /Users/gaborc… bin/… vctrs http… "\"1… c3a69… 0.4.2 aarch6… NA #> 10 /Users/gaborc… src/… pkgcac… NA NA 9b70a… NA NA 0 #> # … with 473 more rows, 2 more variables: vignettes <int>, #> # rversion <chr>, and abbreviated variable name ¹platform
cache_list(package = "recipes")
#> # A data frame: 1 × 11 #> fullp…¹ path package url etag sha256 version platf…² built vigne…³ #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> <int> #> 1 /Users… bin/… recipes http… "\"1… e281e… 1.0.2 aarch6… NA NA #> # … with 1 more variable: rversion <chr>, and abbreviated variable #> # names ¹fullpath, ²platform, ³vignettes
cache_list(platform = "source")
#> # A data frame: 69 × 11 #> fullpath path package url etag sha256 version platf…¹ built #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> #> 1 /Users/gaborc… src/… crayon http… "\"9… 70a9a… 1.5.2 source NA #> 2 /Users/gaborc… src/… zip http… "\"1… 14873… 2.2.1 source NA #> 3 /Users/gaborc… src/… curl http… "\"a… 3567b… 4.3.3 source NA #> 4 /Users/gaborc… src/… rlang http… "\"b… e6973… 1.0.6 source NA #> 5 /Users/gaborc… src/… openssl http… "\"1… 7cde9… 2.0.3 source NA #> 6 /Users/gaborc… src/… tinytex http… "\"8… 205f7… 0.42 source NA #> 7 /Users/gaborc… src/… evalua… http… "\"6… 49c74… 0.17 source NA #> 8 /Users/gaborc… src/… Rcpp http… "\"2… 807ce… 1.0.9 source NA #> 9 /Users/gaborc… src/… knitr http… "\"d… 9b8f9… 1.40 source NA #> 10 /Users/gaborc… src/… lpSolve http… "\"7… f7258… 5.6.17 source NA #> # … with 59 more rows, 2 more variables: vignettes <int>, #> # rversion <chr>, and abbreviated variable name ¹platform
cache_delete(package = "knitr") cache_delete(platform = "macos")
cache_clean()
Please take a look at this list before asking questions.
pak does not reinstall a package, if the same version is already installed.
Sometimes you still want a reinstall, e.g. to fix a broken installation.
In this case you can delete the package and then install it, or use the
?reinstall
parameter:
pak::pkg_install("tibble")
#> #> → Will install 13 packages. #> → All 13 packages (7.68 MB) are cached. #> + cli 3.3.0 #> + crayon 1.5.1 #> + ellipsis 0.3.2 #> + fansi 1.0.3 #> + glue 1.6.2 #> + lifecycle 1.0.1 #> + magrittr 2.0.3 #> + pillar 1.7.0 #> + pkgconfig 2.0.3 #> + rlang 1.0.2 #> + tibble 3.1.7 #> + utf8 1.2.2 #> + vctrs 0.4.1 #> ℹ No downloads are needed, 13 pkgs (7.68 MB) are cached #> ✔ Got utf8 1.2.2 (aarch64-apple-darwin20) (209.24 kB) #> ✔ Installed cli 3.3.0 (76ms) #> ✔ Installed crayon 1.5.1 (87ms) #> ✔ Installed ellipsis 0.3.2 (97ms) #> ✔ Installed fansi 1.0.3 (103ms) #> ✔ Installed glue 1.6.2 (111ms) #> ✔ Installed lifecycle 1.0.1 (153ms) #> ✔ Installed magrittr 2.0.3 (158ms) #> ✔ Installed pillar 1.7.0 (162ms) #> ✔ Installed pkgconfig 2.0.3 (87ms) #> ✔ Installed rlang 1.0.2 (39ms) #> ✔ Installed tibble 3.1.7 (41ms) #> ✔ Installed utf8 1.2.2 (39ms) #> ✔ Installed vctrs 0.4.1 (32ms) #> ✔ 1 pkg + 12 deps: added 13, dld 1 (209.24 kB) [1.8s]
pak::pkg_install("tibble?reinstall")
#> #> → Will install 1 package. #> → The package (724.32 kB) is cached. #> + tibble 3.1.7 #> ℹ No downloads are needed, 1 pkg (724.32 kB) is cached #> ✔ Installed tibble 3.1.7 (42ms) #> ✔ 1 pkg + 12 deps: kept 11, added 1 [343ms]
Sometimes it is sufficient to install the binary package of an older version of a dependency, instead of the newer source package that potentially needs compilers, system tools or libraries.
pkg_install()
and lockfile_create()
default to upgrade = FALSE
, which
always chooses binaries over source packages, so if you use pkg_install()
you don't need to do anything extra.
The local_install_*
functions default to upgrade = TRUE
, as does pak()
with pkg = NULL
, so for these you need to explicitly use upgrade = FALSE
.
To force the installation of a source package (instead of a binary
package), use the ?source
parameter:
pak::pkg_install("tibble?source")
#> #> → Will install 1 package. #> → The package (672.34 kB) is cached. #> + tibble 3.1.7 👷🏼♀️🔧 #> ℹ No downloads are needed, 1 pkg (672.34 kB) is cached #> ℹ Building tibble 3.1.7 #> ✔ Built tibble 3.1.7 (3.1s) #> ✔ Installed tibble 3.1.7 (35ms) #> ✔ 1 pkg + 12 deps: kept 11, added 1 [4.1s]
If you want to always install a dependency from source, because you want
the latest version or some other reason, you can use the source
parameter with the <package>=
form: <package>=?source
.
For example to install tibble, with its cli dependency installed from
source you could write:
pak::pkg_install(c("tibble", "cli=?source"))
#> #> → Will install 1 package. #> → The package (540.04 kB) is cached. #> + cli 3.3.0 👷🏽🔧 #> ℹ No downloads are needed, 1 pkg (540.04 kB) is cached #> ℹ Building cli 3.3.0 #> ✔ Built cli 3.3.0 (4.5s) #> ✔ Installed cli 3.3.0 (68ms) #> ✔ 1 pkg + 12 deps: kept 11, added 1 [4.9s]
pak::pkg_install( c("tibble", "DiagrammeR=?ignore", "formattable=?ignore"), dependencies = TRUE )
#> #> ℹ No downloads are needed #> ✔ 1 pkg + 12 deps: kept 12 [583ms]
The syntax is
<packagename>=?ignore
Note that you can only ignore optional dependencies, i.e. packages in
Suggests
and Enhances
.
Since version 1.0.0 renv has official support for using pak. This needs to be
enabled with the renv.config.pak.enabled
option or the RENV_CONFIG_PAK_ENABLED
environment variable set to TRUE
. For more information see the renv
documentation.
You don't need to read long manual pages for a simple task. This manual page collects the most common pak use cases.
pak::pkg_install("tibble")
pak automatically sets a CRAN repository and the Bioconductor repositories that correspons to the current R version.
pak::pkg_install("tidyverse/tibble")
#> #> → Will update 2 packages. #> → All 2 packages (0 B) are cached. #> + tibble 3.1.8 → 3.1.8.9002 👷🏻🔧 (GitHub: 37ec86a) #> + vctrs 0.5.1 → 0.5.1.9000 👷🏾♀️🔧 (GitHub: 2d7de76) #> ℹ No downloads are needed, 2 pkgs are cached #> ℹ Packaging vctrs 0.5.1.9000 #> ✔ Packaged vctrs 0.5.1.9000 (1.4s) #> ℹ Building vctrs 0.5.1.9000 #> ✔ Built vctrs 0.5.1.9000 (11.2s) #> ✔ Installed vctrs 0.5.1.9000 (github::r-lib/vctrs@2d7de76) (34ms) #> ℹ Packaging tibble 3.1.8.9002 #> ✔ Packaged tibble 3.1.8.9002 (502ms) #> ℹ Building tibble 3.1.8.9002 #> ✔ Built tibble 3.1.8.9002 (2.7s) #> ✔ Installed tibble 3.1.8.9002 (github::tidyverse/tibble@37ec86a) (28ms) #> ✔ 1 pkg + 10 deps: kept 9, upd 2 [17.5s]
Use the user/repo
form.
You can specify a branch or tag: user/repo@branch
or user/repo@tag
.
pak::pkg_install( "url::https://cran.r-project.org/src/contrib/Archive/tibble/tibble_3.1.7.tar.gz" )
#> #> → Will install 1 package. #> → Will update 1 package. #> → All 2 packages (38.65 kB) are cached. #> + ellipsis 0.3.2 #> + tibble 3.1.8.9002 → 3.1.7 👷🏻♀️🔧 #> ℹ No downloads are needed, 2 pkgs (38.65 kB) are cached #> ✔ Installed ellipsis 0.3.2 (18ms) #> ℹ Building tibble 3.1.7 #> ✔ Built tibble 3.1.7 (2.5s) #> ✔ Installed tibble 3.1.7 (31ms) #> ✔ 1 pkg + 11 deps: kept 10, upd 1, added 1 [3.3s]
The URL may point to an R package file, made with R CMD build
, or a
.tar.gz
or .zip
archive of a package tree.
pak::pkg_install("tibble")
#> #> → Will update 1 package. #> → The package (724.32 kB) is cached. #> + tibble 3.1.7 → 3.1.8 #> ℹ No downloads are needed, 1 pkg (724.32 kB) is cached #> ✔ Installed tibble 3.1.8 (36ms) #> ✔ 1 pkg + 10 deps: kept 10, upd 1 [368ms]
pak::pkg_install()
automatically updates the package.
pak::pkg_install("tibble", upgrade = TRUE)
#> #> ℹ No downloads are needed #> ✔ 1 pkg + 10 deps: kept 11 [278ms]
upgrade = TRUE
updates the package itself and all of its dependencies, if
necessary.
Add ?reinstall
to the package name or package reference in general:
pak::pkg_install("tibble?reinstall")
#> #> → Will install 1 package. #> → The package (724.32 kB) is cached. #> + tibble 3.1.8 #> ℹ No downloads are needed, 1 pkg (724.32 kB) is cached #> ✔ Installed tibble 3.1.8 (60ms) #> ✔ 1 pkg + 10 deps: kept 10, added 1 [340ms]
pak::pkg_deps("tibble")
#> # A data frame: 11 × 32 #> ref type direct direc…¹ status package version license needs…² #> <chr> <chr> <lgl> <lgl> <chr> <chr> <chr> <chr> <lgl> #> 1 cli stan… FALSE FALSE OK cli 3.4.1 MIT + … FALSE #> 2 fansi stan… FALSE FALSE OK fansi 1.0.3 GPL-2 … FALSE #> 3 glue stan… FALSE FALSE OK glue 1.6.2 MIT + … FALSE #> 4 lifecycle stan… FALSE FALSE OK lifecy… 1.0.3 MIT + … FALSE #> 5 magrittr stan… FALSE FALSE OK magrit… 2.0.3 MIT + … FALSE #> 6 pillar stan… FALSE FALSE OK pillar 1.8.1 MIT + … FALSE #> 7 pkgconfig stan… FALSE FALSE OK pkgcon… 2.0.3 MIT + … FALSE #> 8 rlang stan… FALSE FALSE OK rlang 1.0.6 MIT + … FALSE #> 9 tibble stan… TRUE TRUE OK tibble 3.1.8 MIT + … FALSE #> 10 utf8 stan… FALSE FALSE OK utf8 1.2.2 Apache… FALSE #> 11 vctrs stan… FALSE FALSE OK vctrs 0.5.1 MIT + … FALSE #> # … with 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>, #> # filesize <int>, built <chr>, platform <chr>, rversion <chr>, #> # repotype <chr>, repodir <chr>, target <chr>, deps <list>, #> # mirror <chr>, sources <list>, remote <list>, error <list>, #> # metadata <list>, dep_types <list>, params <list>, sysreqs <chr>, #> # cache_status <chr>, lib_status <chr>, old_version <chr>, #> # new_version <chr>, and abbreviated variable names ¹directpkg, …
The results are returned in a data frame.
pak::pkg_deps_tree("tibble")
#> tibble 3.1.8 ✨ #> ├─fansi 1.0.3 ✨ #> ├─lifecycle 1.0.3 ✨ #> │ ├─cli 3.4.1 ✨ #> │ ├─glue 1.6.2 ✨ #> │ └─rlang 1.0.6 ✨ #> ├─magrittr 2.0.3 ✨ #> ├─pillar 1.8.1 ✨ #> │ ├─cli #> │ ├─fansi #> │ ├─glue #> │ ├─lifecycle #> │ ├─rlang #> │ ├─utf8 1.2.2 ✨ #> │ └─vctrs 0.5.1 ✨ #> │ ├─cli #> │ ├─glue #> │ ├─lifecycle #> │ └─rlang #> ├─pkgconfig 2.0.3 ✨ #> ├─rlang #> └─vctrs #> #> Key: ✨ new
The results are also silently returned in a data frame.
pak::pkg_deps_tree("tidyverse/tibble")
#> tidyverse/tibble 3.1.8.9002 ✨👷🏼🔧 #> ├─fansi 1.0.3 ✨ #> ├─lifecycle 1.0.3 ✨ #> │ ├─cli 3.4.1 ✨ #> │ ├─glue 1.6.2 ✨ #> │ └─rlang 1.0.6 ✨ #> ├─magrittr 2.0.3 ✨ #> ├─pillar 1.8.1 ✨ #> │ ├─cli #> │ ├─fansi #> │ ├─glue #> │ ├─lifecycle #> │ ├─rlang #> │ ├─utf8 1.2.2 ✨ #> │ └─r-lib/vctrs 0.5.1.9000 ✨👷🏼🔧 #> │ ├─cli #> │ ├─glue #> │ ├─lifecycle #> │ └─rlang #> ├─pkgconfig 2.0.3 ✨ #> ├─rlang #> └─r-lib/vctrs #> #> Key: ✨ new | 👷🏼 build | 🔧 compile
Use the user/repo
form.
As usual, you can also select a branch, tag, or sha, with the
user/repo@branch
, user/repo@tag
or user/repo@sha
forms.
pak::local_deps_tree("tibble")
#> local::tibble 3.1.8 ✨👷🏻♀️🔧 #> ├─fansi 1.0.3 ✨ #> ├─lifecycle 1.0.3 ✨ #> │ ├─cli 3.4.1 ✨ #> │ ├─glue 1.6.2 ✨ #> │ └─rlang 1.0.6 ✨ #> ├─magrittr 2.0.3 ✨ #> ├─pillar 1.8.1 ✨ #> │ ├─cli #> │ ├─fansi #> │ ├─glue #> │ ├─lifecycle #> │ ├─rlang #> │ ├─utf8 1.2.2 ✨ #> │ └─vctrs 0.5.1 ✨ #> │ ├─cli #> │ ├─glue #> │ ├─lifecycle #> │ └─rlang #> ├─pkgconfig 2.0.3 ✨ #> ├─rlang #> └─vctrs #> #> Key: ✨ new | 👷🏻♀️ build | 🔧 compile
Assuming package is in directory tibble
.
How does tibble depend on rlang?
pak::pkg_deps_explain("tibble", "rlang")
#> tibble -> lifecycle -> rlang #> tibble -> pillar -> lifecycle -> rlang #> tibble -> pillar -> rlang #> tibble -> pillar -> vctrs -> lifecycle -> rlang #> tibble -> pillar -> vctrs -> rlang #> tibble -> rlang #> tibble -> vctrs -> lifecycle -> rlang #> tibble -> vctrs -> rlang
Use can also use the user/repo
form for packages from GitHub,
url::...
for packages at URLs, etc.
pak::local_install_deps()
#> ✔ Loading metadata database ... done #> #> → The package (0 B) is cached. #> ℹ No downloads are needed #> ✔ 10 deps: kept 10 [3.2s]
pak::local_install()
#> #> → Will update 1 package. #> → The package (0 B) is cached. #> + tibble 3.1.8 → 3.1.8 👷🏻♂️🔧 #> ℹ No downloads are needed, 1 pkg is cached #> ✔ Got tibble 3.1.8 (source) (96 B) #> ℹ Packaging tibble 3.1.8 #> ✔ Packaged tibble 3.1.8 (864ms) #> ℹ Building tibble 3.1.8 #> ✔ Built tibble 3.1.8 (2.4s) #> ✔ Installed tibble 3.1.8 (local) (38ms) #> ✔ 1 pkg + 10 deps: kept 10, upd 1, dld 1 (NA B) [4.2s]
pak::local_install_dev_deps()
#> #> → Will install 86 packages. #> → Will update 2 packages. #> → All 89 packages (100.53 MB) are cached. #> + askpass 1.1 #> + base64enc 0.1-3 #> + bench 1.1.2 #> + bit 4.0.5 #> + bit64 4.0.5 #> + blob 1.2.3 #> + brio 1.1.3 #> + bslib 0.4.1 #> + cachem 1.0.6 #> + callr 3.7.3 #> + clipr 0.8.0 #> + colorspace 2.0-3 #> + covr 3.6.1 #> + crayon 1.5.2 #> + curl 4.3.3 #> + desc 1.4.2 #> + DiagrammeR 1.0.9 #> + diffobj 0.3.5 #> + digest 0.6.31 #> + downloader 0.4 #> + dplyr 1.0.10 #> + evaluate 0.19 👷🏿♂️ #> + farver 2.1.1 #> + fastmap 1.1.0 #> + formattable 0.2.1 #> + fs 1.5.2 #> + generics 0.1.3 #> + ggplot2 3.4.0 #> + gridExtra 2.3 #> + gtable 0.3.1 #> + highr 0.9 #> + hms 1.1.2 #> + htmltools 0.5.4 #> + htmlwidgets 1.6.0 👷🏾♂️ #> + httr 1.4.4 #> + igraph 1.3.5 #> + influenceR 0.1.0.1 #> + isoband 0.2.6 #> + jquerylib 0.1.4 #> + jsonlite 1.8.4 #> + knitr 1.41 #> + labeling 0.4.2 #> + lazyeval 0.2.2 #> + lubridate 1.9.0 #> + Matrix 1.5-1 → 1.5-3 #> + memoise 2.0.1 #> + mime 0.12 #> + mockr 0.2.0 #> + munsell 0.5.0 #> + nlme 3.1-160 → 3.1-161 👷♂️🔧 #> + nycflights13 1.0.2 #> + openssl 2.0.5 #> + pkgbuild 1.4.0 #> + pkgload 1.3.2 #> + praise 1.0.0 #> + prettyunits 1.1.1 #> + processx 3.8.0 #> + profmem 0.6.0 #> + ps 1.7.2 #> + purrr 0.3.5 #> + R6 2.5.1 #> + rappdirs 0.3.3 #> + RColorBrewer 1.1-3 #> + readr 2.1.3 #> + rematch2 2.1.2 #> + rex 1.2.1 #> + rmarkdown 2.19 👷♂️ #> + rprojroot 2.0.3 #> + rstudioapi 0.14 #> + sass 0.4.4 #> + scales 1.2.1 #> + stringi 1.7.8 #> + stringr 1.5.0 #> + sys 3.4.1 #> + testthat 3.1.6 #> + tidyr 1.2.1 #> + tidyselect 1.2.0 #> + timechange 0.1.1 #> + tinytex 0.43 👷🏻♂️ #> + tzdb 0.3.0 #> + viridis 0.6.2 #> + viridisLite 0.4.1 #> + visNetwork 2.1.2 #> + vroom 1.6.0 #> + waldo 0.4.0 #> + withr 2.5.0 #> + xfun 0.35 #> + yaml 2.3.6 #> ℹ No downloads are needed, 88 pkgs (100.53 MB) are cached #> ℹ Packaging tibble 3.1.8 #> ℹ Building evaluate 0.19 #> ℹ Building nlme 3.1-161 #> ✔ Installed R6 2.5.1 (31ms) #> ✔ Installed DiagrammeR 1.0.9 (76ms) #> ✔ Installed RColorBrewer 1.1-3 (72ms) #> ✔ Installed askpass 1.1 (79ms) #> ✔ Installed Matrix 1.5-3 (137ms) #> ✔ Installed base64enc 0.1-3 (125ms) #> ✔ Installed bench 1.1.2 (90ms) #> ✔ Installed bit64 4.0.5 (44ms) #> ✔ Installed bit 4.0.5 (43ms) #> ✔ Installed blob 1.2.3 (41ms) #> ✔ Installed brio 1.1.3 (40ms) #> ✔ Installed cachem 1.0.6 (31ms) #> ✔ Installed callr 3.7.3 (53ms) #> ✔ Installed clipr 0.8.0 (89ms) #> ✔ Installed colorspace 2.0-3 (99ms) #> ✔ Installed covr 3.6.1 (58ms) #> ✔ Installed crayon 1.5.2 (75ms) #> ✔ Installed curl 4.3.3 (83ms) #> ✔ Packaged tibble 3.1.8 (684ms) #> ✔ Installed bslib 0.4.1 (315ms) #> ✔ Installed desc 1.4.2 (77ms) #> ✔ Installed diffobj 0.3.5 (68ms) #> ✔ Installed digest 0.6.31 (60ms) #> ✔ Installed downloader 0.4 (39ms) #> ✔ Installed dplyr 1.0.10 (39ms) #> ✔ Installed farver 2.1.1 (41ms) #> ✔ Installed fastmap 1.1.0 (38ms) #> ✔ Installed formattable 0.2.1 (43ms) #> ✔ Built evaluate 0.19 (903ms) #> ✔ Installed fs 1.5.2 (49ms) #> ✔ Installed generics 0.1.3 (46ms) #> ✔ Installed ggplot2 3.4.0 (65ms) #> ✔ Installed gridExtra 2.3 (43ms) #> ✔ Installed gtable 0.3.1 (38ms) #> ✔ Installed highr 0.9 (37ms) #> ✔ Installed hms 1.1.2 (39ms) #> ✔ Installed htmltools 0.5.4 (40ms) #> ✔ Installed httr 1.4.4 (40ms) #> ✔ Installed influenceR 0.1.0.1 (17ms) #> ✔ Installed igraph 1.3.5 (96ms) #> ✔ Installed isoband 0.2.6 (68ms) #> ✔ Installed jquerylib 0.1.4 (38ms) #> ✔ Installed jsonlite 1.8.4 (37ms) #> ✔ Installed labeling 0.4.2 (14ms) #> ✔ Installed knitr 1.41 (73ms) #> ✔ Installed lazyeval 0.2.2 (43ms) #> ✔ Installed lubridate 1.9.0 (38ms) #> ✔ Installed memoise 2.0.1 (39ms) #> ✔ Installed mime 0.12 (58ms) #> ✔ Installed mockr 0.2.0 (38ms) #> ✔ Installed munsell 0.5.0 (36ms) #> ✔ Installed nycflights13 1.0.2 (37ms) #> ✔ Installed openssl 2.0.5 (41ms) #> ✔ Installed pkgbuild 1.4.0 (39ms) #> ✔ Installed pkgload 1.3.2 (37ms) #> ✔ Installed praise 1.0.0 (35ms) #> ✔ Installed prettyunits 1.1.1 (56ms) #> ✔ Installed processx 3.8.0 (37ms) #> ✔ Installed profmem 0.6.0 (37ms) #> ✔ Installed ps 1.7.2 (37ms) #> ✔ Installed purrr 0.3.5 (38ms) #> ✔ Installed rappdirs 0.3.3 (37ms) #> ✔ Installed readr 2.1.3 (42ms) #> ✔ Installed rematch2 2.1.2 (41ms) #> ✔ Installed rex 1.2.1 (58ms) #> ✔ Installed rprojroot 2.0.3 (58ms) #> ✔ Installed rstudioapi 0.14 (40ms) #> ✔ Installed sass 0.4.4 (42ms) #> ✔ Installed scales 1.2.1 (39ms) #> ✔ Installed stringr 1.5.0 (33ms) #> ✔ Installed sys 3.4.1 (49ms) #> ✔ Installed testthat 3.1.6 (88ms) #> ✔ Installed tidyr 1.2.1 (77ms) #> ✔ Installed stringi 1.7.8 (195ms) #> ✔ Installed tidyselect 1.2.0 (113ms) #> ✔ Installed timechange 0.1.1 (55ms) #> ✔ Installed tzdb 0.3.0 (40ms) #> ✔ Installed viridisLite 0.4.1 (39ms) #> ✔ Installed viridis 0.6.2 (39ms) #> ✔ Installed visNetwork 2.1.2 (77ms) #> ✔ Installed vroom 1.6.0 (77ms) #> ✔ Installed waldo 0.4.0 (62ms) #> ✔ Installed withr 2.5.0 (40ms) #> ✔ Installed xfun 0.35 (39ms) #> ℹ Building tinytex 0.43 #> ✔ Installed yaml 2.3.6 (43ms) #> ✔ Installed evaluate 0.19 (15ms) #> ✔ Built tinytex 0.43 (1.1s) #> ✔ Installed tinytex 0.43 (15ms) #> ℹ Building rmarkdown 2.19 #> ✔ Built rmarkdown 2.19 (3.9s) #> ✔ Installed rmarkdown 2.19 (85ms) #> ℹ Building htmlwidgets 1.6.0 #> ✔ Built nlme 3.1-161 (8s) #> ✔ Installed nlme 3.1-161 (33ms) #> ✔ Built htmlwidgets 1.6.0 (1.1s) #> ✔ Installed htmlwidgets 1.6.0 (22ms) #> ✔ 103 deps: kept 15, upd 2, added 86 [10.2s]
Installs development and optional dependencies as well.
pak::repo_get()
#> # A data frame: 5 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cloud.r-project.org cran * NA #> 2 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 3 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
If you haven't set a CRAN or Bioconductor repository, pak does that automatically.
pak::repo_add(rhub = 'https://r-hub.r-universe.dev') pak::repo_get()
#> # A data frame: 6 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cloud.r-project.org cran * NA #> 2 rhub https://r-hub.r-universe.dev cran… * NA #> 3 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 6 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
options(repos = getOption("repos")["CRAN"]) pak::repo_get()
#> # A data frame: 5 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cloud.r-project.org cran * NA #> 2 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 3 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
If you set the repos
option to a CRAN repo only, or unset it completely,
then pak keeps only CRAN and (by default) Bioconductor.
pak::repo_add(CRAN = "RSPM@2022-06-30") pak::repo_get()
#> # A data frame: 5 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://packagemanager.posit.co/c… cran * NA #> 2 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 3 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
Sets a repository that is equivalent to CRAN's state closest to the
specified date.
Name this repository CRAN
, otherwise pak will also add a default CRAN
repository.
pak::repo_add(CRAN = "MRAN@2022-06-30") pak::repo_get()
#> # A data frame: 5 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cran.microsoft.com/snapsh… cran * NA #> 2 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 3 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
Sets a repository that is equivalent to CRAN's state at the specified date.
Name this repository CRAN
, otherwise pak will also add a default CRAN
repository.
By default pak caches both metadata and downloaded packages.
pak::meta_list()
#> ✔ Updated metadata database: 4.55 MB in 4 files. #> ✔ Updating metadata database ... done #> # A data frame: 43,718 × 32 #> package version depends sugge…¹ license imports linki…² archs enhan…³ #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 A3 1.0.0 R (>= … random… GPL (>… NA NA NA NA #> 2 AATtoo… 0.0.1 R (>= … NA GPL-3 magrit… NA NA NA #> 3 ABACUS 1.0.0 R (>= … rmarkd… GPL-3 ggplot… NA NA NA #> 4 ABC.RAP 0.9.0 R (>= … knitr,… GPL-3 graphi… NA NA NA #> 5 ABCana… 1.2.1 R (>= … NA GPL-3 plotrix NA NA NA #> 6 ABCopt… 0.15.0 NA testth… MIT + … Rcpp, … Rcpp ABCo… NA #> 7 ABCp2 1.2 MASS NA GPL-2 NA NA NA NA #> 8 ABHgen… 1.0.1 NA knitr,… GPL-3 ggplot… NA NA NA #> 9 ABPS 0.3 NA testth… GPL (>… kernlab NA NA NA #> 10 ACA 1.1 R (>= … NA GPL graphi… NA NA NA #> # … with 43,708 more rows, 23 more variables: os_type <chr>, #> # priority <chr>, license_is_foss <chr>, license_restricts_use <chr>, #> # repodir <chr>, rversion <chr>, platform <chr>, #> # needscompilation <chr>, ref <chr>, type <chr>, direct <lgl>, #> # status <chr>, target <chr>, mirror <chr>, sources <list>, #> # filesize <int>, sha256 <chr>, sysreqs <chr>, built <chr>, #> # published <dttm>, deps <list>, md5sum <chr>, path <chr>, and …
By default pkg_install()
and similar functions automatically update the
metadata for the currently set repositories if it is older than 24 hours.
You can also force an update manually:
pak::meta_update()
#> ✔ Updating metadata database ... done
pak::meta_clean(force = TRUE) pak::meta_summary()
#> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metad #> ata" #> #> $current_db #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metad #> ata/pkgs-d1c324e625.rds" #> #> $raw_files #> character(0) #> #> $db_files #> character(0) #> #> $size #> [1] 0 #>
Downloaded packages are also cached.
pak::cache_list()
#> # A data frame: 480 × 11 #> fullpath path package url etag sha256 version platf…¹ built #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> #> 1 /Users/gaborc… arch… NA http… "\"1… 0c8f0… NA NA NA #> 2 /Users/gaborc… bin/… evalua… http… "\"1… 08a39… 0.17 aarch6… NA #> 3 /Users/gaborc… bin/… crayon http… "\"2… 1e6d5… 1.5.2 aarch6… NA #> 4 /Users/gaborc… bin/… common… http… "\"4… 47b4a… 1.8.1 aarch6… NA #> 5 /Users/gaborc… bin/… curl http… "\"b… 7b8ba… 4.3.3 aarch6… NA #> 6 /Users/gaborc… bin/… tinytex http… "\"2… 7e9ba… 0.42 aarch6… NA #> 7 /Users/gaborc… bin/… jsonli… http… "\"1… 68e59… 1.8.2 aarch6… NA #> 8 /Users/gaborc… bin/… lifecy… http… "\"1… 7ce27… 1.0.3 aarch6… NA #> 9 /Users/gaborc… bin/… vctrs http… "\"1… c3a69… 0.4.2 aarch6… NA #> 10 /Users/gaborc… src/… pkgcac… NA NA 9b70a… NA NA 0 #> # … with 470 more rows, 2 more variables: vignettes <int>, #> # rversion <chr>, and abbreviated variable name ¹platform
pak::cache_summary()
#> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/pkg" #> #> $files #> [1] 480 #> #> $size #> [1] 653325143 #>
pak::cache_clean()
pak::lib_status(Sys.getenv("R_LIBS_USER"))
#> # A data frame: 701 × 39 #> library package title version depends repos…¹ license needs…² built #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <chr> #> 1 /Users/g… abc "Too… 2.2.1 R (>= … CRAN GPL (>… FALSE R 4.… #> 2 /Users/g… abc.da… "Dat… 1.0 R (>= … CRAN GPL (>… FALSE R 4.… #> 3 /Users/g… abind "Com… 1.4-5 R (>= … CRAN LGPL (… FALSE R 4.… #> 4 /Users/g… ade4 "Ana… 1.7-19 R (>= … CRAN GPL (>… TRUE R 4.… #> 5 /Users/g… ape "Ana… 5.6-2 R (>= … CRAN GPL-2 … TRUE R 4.… #> 6 /Users/g… aplot "Dec… 0.1.7 NA CRAN Artist… FALSE R 4.… #> 7 /Users/g… archive "Mul… 1.1.5 R (>= … CRAN MIT + … TRUE R 4.… #> 8 /Users/g… arrayh… "Con… 1.1-0 NA CRAN GPL FALSE R 4.… #> 9 /Users/g… arrow "Int… 9.0.0 R (>= … CRAN Apache… TRUE R 4.… #> 10 /Users/g… arules "Min… 1.7-5 R (>= … CRAN GPL-3 TRUE R 4.… #> # … with 691 more rows, 30 more variables: remotetype <chr>, #> # remotepkgref <chr>, remoteref <chr>, remoterepos <chr>, #> # remotepkgplatform <chr>, remotesha <chr>, imports <chr>, #> # suggests <chr>, linkingto <chr>, remotes <chr>, remotehost <chr>, #> # remoterepo <chr>, remoteusername <chr>, enhances <chr>, #> # biocviews <chr>, remoteurl <chr>, remotesubdir <chr>, #> # priority <chr>, remoteetag <chr>, remotepackaged <chr>, …
Pass the directory of the library as the argument.
A list of the most important pak features.
pak performs HTTP queries concurrently. This is true when
it downloads package metadata from package repositories,
it resolves packages from CRAN, GitHub, URLs, etc,
it downloads the actual package files,
etc.
pak installs packages concurrently, as much as their dependency graph allows this.
pak caches metadata and package files, so you don't need to re-download the same files over and over.
pak creates an installation plan before downloading any packages. If the plan is unsuccessful, then it fails without downloading any packages.
When requesting the installation of a package, pak makes sure that all of its dependencies are also installed.
pak automatically discards binary packages from the cache, if a new build of the same version is available on CRAN.
pak can correct some of CRAN's metadata issues, e.g.:
New version of the package was released since we obtained the metadata.
macOS binary package is only available at https://mac.r-project.org/ because of a synchronization issue.
pak handles the situation of locked package DLLs, as well as possible. It detects which process locked them, and offers the choice of terminating these processes. It also unloads packages from the current R session as needed.
pak keeps its own dependencies in a private package library and never loads any packages. (Only in background processes).
On the most common platforms. No dependencies, no system dependencies, no compiler needed. (See also the installation manual.)
CRAN, Bioconductor
GitHub
URLs
Local files or directories.
pak can ignore certain optional dependencies if requested.
pak knows the sizes of CRAN package files, so it can estimate how much data you need to download, before the installation.
pak automatically selects the Bioconductor version that is appropriate for your R version. No need to set any repositories.
pak can use PPM (Posit Public Package Manager) to install from snapshots or CRAN.
Very handy for package development!
Use this function to set up a global error handler, that is called if R fails to load a package. This handler will offer you the choice of installing the missing package (and all its dependencies), and in some cases it can also remedy the error and restart the code.
handle_package_not_found(err)
handle_package_not_found(err)
err |
The error object, of class |
You are not supposed to call this function directly. Instead, set it
up as a global error handler, possibly in your .Rprofile
file:
if (interactive() && getRversion() >= "4.0.0") { globalCallingHandlers( packageNotFoundError = function(err) { try(pak::handle_package_not_found(err)) } ) }
Global error handlers are only supported in R 4.0.0 and later.
Currently handle_package_not_found()
does not do anything in
non-interactive mode (including in knitr, testthat and RStudio
notebooks), this might change in the future.
In some cases it is possible to remedy the original computation that
tried to load the missing package, and pak will offer you to do so
after a successful installation. Currently, in R 4.0.4, it is not
possible to continue a failed library()
call.
Nothing.
Read this if the default installation methods do not work for you or if you want the release candidate or development version.
Our pre-built binaries have the advantage that they are completely self-containted and dependency free. No additional R packages, system libraries or tools (e.g. compilers) are needed for them. Install a pre-built binary build of pak from our repository on GitHub:
install.packages("pak", repos = sprintf( "https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch ))
This is supported for the following systems:
OS | CPU | R version |
Linux | x86_64 | R 3.4.0 - R-devel |
Linux | aarch64 | R 3.4.0 - R-devel |
macOS High Sierra+ | x86_64 | R 3.4.0 - R-devel |
macOS Big Sur+ | aarch64 | R 4.1.0 - R-devel |
Windows | x86_64 | R 3.4.0 - R-devel |
FreeBSD 13.x or later | x86_64 | R 4.4.x |
OpenBSD 7.4, 7.5, 7.6 | x86_64 | R 4.2.x (7.4, 7.5), R 4.4.x (7.6) |
NetBSD 10.0 | x86_64 | R 4.4.x |
DragonFly BSD 6.4 | x86_64 | R 4.3.x |
For macOS we only support the official CRAN R build. Other builds, e.g. Homebrew R, are not supported.
We only support R builds that have an R shared library. CRAN's Windows
and macOS installers are such, so the the R builds in the common Linux
distributions. But this might be an issue if you build R yourself without
the --enable-R-shlib
option.
Install the released version of the package from CRAN as usual:
install.packages("pak")
This potentially needs a C compiler on platforms CRAN does not have binaries packages for.
We have nightly binary builds, for the same systems as the table above:
install.packages("pak", repos = sprintf( "https://r-lib.github.io/p/pak/devel/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch ))
stable
, rc
and devel
streamsWe have three types of binaries available:
stable
corresponds to the latest CRAN release of CRAN.
rc
is a release candidate build, and it is available about 1-2 weeks
before a release. Otherwise it is the same as the stable
build.
devel
has builds from the development tree. Before release it might be
the same as the rc
build.
The streams are available under different repository URLs:
stream <- "rc" install.packages("pak", repos = sprintf( "https://r-lib.github.io/p/pak/%s/%s/%s/%s", stream, .Platform$pkgType, R.Version()$os, R.Version()$arch ))
Status of packages in a library
lib_status(lib = .libPaths()[1]) pkg_list(lib = .libPaths()[1])
lib_status(lib = .libPaths()[1]) pkg_list(lib = .libPaths()[1])
lib |
Path to library. |
Data frame the contains data about the packages installed in the library. It has always has columns:
biocviews
: the corresponding field from DESCRIPTION
, it must be
present for all Bioconductor packages, other packages typically don't
have it.
built
: the Built
field from DESCRIPTION
.
depends
, suggests
, Imports
, linkingto
, enhances
: the corresponding
fields from the DESCRIPTION
files.
deps
: A list or data frames, the dependencies of the package. It has
columns: ref
, type
(dependency type in lowercase), package
(dependent package, or R
), op
and version
, for last two are for
version requirement. op
can be >=
, >
, ==
or <=
, although the
only the first one is common in practice.
library
: path to the package library containing the package.
license
: from DESCRIPTION
.
md5sum
: from DESCTIPTION
, typically NA
, except on Windows.
needscompilation
: from DESCRIPTION
, this column is logical.
package
: package name.
platform
: from the Built
field in DESCRIPTION
, the current platform
if missing from DESCRIPTION
.
priority
: from DESCRIPTION
, usually base
, recommended
, or missing.
ref
: the corresponding installed::*
package reference.
repository
: from DESCRIPTION
. For packages from a CRAN repository this
is CRAN
, some other repositories, e.g. R-universe adds the repository
URL here.
repotype
: cran
, bioc
or missing.
rversion
: from the Built
field. If no such field, then the current
R version.
sysreqs
: the SystemRequirements
field from DESCRIPTION
.
title
: package title.
type
: always installed
.
version
: package version (as string).
Most of these columns are unchanged from DESCRIPTION
, but
pak also adds a couple.
In addition, it also has all remote*
and config/needs/*
entries from
the DESCRIPTION
files. (Case insensitive.)
All columns are of type character
, except for needscompilation
, which
is logical and deps
, which is a list columns.
If an entry is missing for a package, it is set to NA
.
Note that column names are lowercase, even if the corresponding entries
are not in DESCRIPTION
.
The order of the columns is not deterministic, so don't assume any order.
Additional columns might be present, these are internal for pak and should not be used in user code.
lib_status(.Library)
#> # A data frame: 31 × 31 #> library package version prior…¹ title license sugge…² built depends #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 /Library… base 4.2.2 base "The… Part o… methods R 4.… NA #> 2 /Library… boot 1.3-28 recomm… "Boo… Unlimi… MASS, … R 4.… R (>= … #> 3 /Library… class 7.3-20 recomm… "Fun… GPL-2 … NA R 4.… R (>= … #> 4 /Library… cluster 2.1.4 recomm… "\"F… GPL (>… MASS, … R 4.… R (>= … #> 5 /Library… codeto… 0.2-18 recomm… "Cod… GPL NA R 4.… R (>= … #> 6 /Library… compil… 4.2.2 base "The… Part o… NA R 4.… NA #> 7 /Library… datase… 4.2.2 base "The… Part o… NA R 4.… NA #> 8 /Library… filelo… 1.0.2 NA "Por… MIT + … callr … R 4.… NA #> 9 /Library… foreign 0.8-83 recomm… "Rea… GPL (>… NA R 4.… R (>= … #> 10 /Library… graphi… 4.2.2 base "The… Part o… NA R 4.… NA #> # … with 21 more rows, 22 more variables: needscompilation <lgl>, #> # repository <chr>, imports <chr>, remotetype <chr>, #> # remotepkgref <chr>, remoteref <chr>, remoterepos <chr>, #> # remotepkgplatform <chr>, remotesha <chr>, enhances <chr>, #> # linkingto <chr>, md5sum <chr>, platform <chr>, biocviews <chr>, #> # sysreqs <chr>, ref <chr>, type <chr>, status <chr>, rversion <chr>, #> # sources <list>, repotype <chr>, deps <list>, and abbreviated …
Other package functions:
pak()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
Dependencies of a package tree
local_deps(root = ".", upgrade = TRUE, dependencies = NA) local_deps_tree(root = ".", upgrade = TRUE, dependencies = NA) local_dev_deps(root = ".", upgrade = TRUE, dependencies = TRUE) local_dev_deps_tree(root = ".", upgrade = TRUE, dependencies = TRUE)
local_deps(root = ".", upgrade = TRUE, dependencies = NA) local_deps_tree(root = ".", upgrade = TRUE, dependencies = NA) local_dev_deps(root = ".", upgrade = TRUE, dependencies = TRUE) local_dev_deps_tree(root = ".", upgrade = TRUE, dependencies = TRUE)
root |
Path to the package tree. |
upgrade |
Whether to use the most recent available package versions. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
All of these functions return the dependencies in a data
frame. local_deps_tree()
and local_dev_deps_tree()
also
print the dependency tree.
Other local package trees:
local_deps_explain()
,
local_install_deps()
,
local_install_dev_deps()
,
local_install()
,
local_package_trees
,
pak()
These functions are similar to pkg_deps_explain()
, but work on a
local package tree. local_dev_deps_explain()
also includes development
dependencies.
local_deps_explain(deps, root = ".", upgrade = TRUE, dependencies = NA) local_dev_deps_explain(deps, root = ".", upgrade = TRUE, dependencies = TRUE)
local_deps_explain(deps, root = ".", upgrade = TRUE, dependencies = NA) local_dev_deps_explain(deps, root = ".", upgrade = TRUE, dependencies = TRUE)
deps |
Package names of the dependencies to explain. |
root |
Path to the package tree. |
upgrade |
Whether to use the most recent available package versions. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
Other local package trees:
local_deps()
,
local_install_deps()
,
local_install_dev_deps()
,
local_install()
,
local_package_trees
,
pak()
Installs a package tree (or source package file), together with its dependencies.
local_install( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = NA )
local_install( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = NA )
root |
Path to the package tree. |
lib |
Package library to install the packages to. Note that all
dependent packages will be installed here, even if they are
already installed in another library. The only exceptions are base
and recommended packages installed in |
upgrade |
When When |
ask |
Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
local_install()
is equivalent to pkg_install("local::.")
.
Data frame, with information about the installed package(s).
Other local package trees:
local_deps_explain()
,
local_deps()
,
local_install_deps()
,
local_install_dev_deps()
,
local_package_trees
,
pak()
Installs the hard dependencies of a package tree (or source package file), without installing the package tree itself.
local_install_deps( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = NA )
local_install_deps( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = NA )
root |
Path to the package tree. |
lib |
Package library to install the packages to. Note that all
dependent packages will be installed here, even if they are
already installed in another library. The only exceptions are base
and recommended packages installed in |
upgrade |
When When |
ask |
Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
Note that development (and optional) dependencies, under Suggests
in
DESCRIPTION
, are not installed. If you want to install them as well,
use local_install_dev_deps()
.
Data frame, with information about the installed package(s).
Other local package trees:
local_deps_explain()
,
local_deps()
,
local_install_dev_deps()
,
local_install()
,
local_package_trees
,
pak()
Installs all dependencies of a package tree (or source package file),
without installing the package tree itself. It installs the development
dependencies as well, specified in the Suggests
field of
DESCRIPTION
.
local_install_dev_deps( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = TRUE )
local_install_dev_deps( root = ".", lib = .libPaths()[1], upgrade = TRUE, ask = interactive(), dependencies = TRUE )
root |
Path to the package tree. |
lib |
Package library to install the packages to. Note that all
dependent packages will be installed here, even if they are
already installed in another library. The only exceptions are base
and recommended packages installed in |
upgrade |
When When |
ask |
Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
Other local package trees:
local_deps_explain()
,
local_deps()
,
local_install_deps()
,
local_install()
,
local_package_trees
,
pak()
pak can install packages from local package trees. This is convenient for package development. See the following functions:
local_install()
installs a package from a package tree and all of its
dependencies.
local_install_deps()
installs all hard dependencies of a package.
local_install_dev_deps()
installs all hard and soft dependencies
of a package. This function is intended for package development.
Note that the last two functions do not install the package in the
specified package tree itself, only its dependencies. This is convenient
if the package itself is loaded via some other means, e.g.
devtools::load_all()
, for development.
Other local package trees:
local_deps_explain()
,
local_deps()
,
local_install_deps()
,
local_install_dev_deps()
,
local_install()
,
pak()
Note that these functions are now deprecated, in favor of
pkg_sysreqs()
and the sysreqs_*
functions, which are more
powerful, as they work for all package sources (packages at Github,
GitLab, URLs, etc.) and they have more detailed output.
Instead of
pak::pkg_system_requirement("curl")
call
pak::pkg_sysreqs("curl")$install_scripts
and the equivalent of
pak::local_system_requirements()
is
pak::pkg_sysreqs("local::.", dependencies = TRUE)$install_script
local_system_requirements( os = NULL, os_release = NULL, root = ".", execute = FALSE, sudo = execute, echo = FALSE ) pkg_system_requirements( package, os = NULL, os_release = NULL, execute = FALSE, sudo = execute, echo = FALSE )
local_system_requirements( os = NULL, os_release = NULL, root = ".", execute = FALSE, sudo = execute, echo = FALSE ) pkg_system_requirements( package, os = NULL, os_release = NULL, execute = FALSE, sudo = execute, echo = FALSE )
os , os_release
|
The operating system and operating system release version, e.g. "ubuntu", "debian", "centos", "redhat". See https://github.com/rstudio/r-system-requirements#operating-systems for all full list of supported operating systems. If |
root |
Path to the package tree. |
execute , sudo
|
If |
echo |
If |
package |
Package names to lookup system requirements for. |
Returns a character vector of commands to run that will install system requirements for the queried operating system.
local_system_requirements()
queries system requirements for a dev package
(and its dependencies) given its root
path.
pkg_system_requirements()
queries system requirements for existing packages
(and their dependencies).
A character vector of commands needed to install the system requirements for the package.
local_system_requirements("ubuntu", "20.04") pkg_system_requirements("pak", "ubuntu", "20.04") pkg_system_requirements("pak", "redhat", "7") pkg_system_requirements("config", "ubuntu", "20.04") # no sys reqs pkg_system_requirements("curl", "ubuntu", "20.04") pkg_system_requirements("git2r", "ubuntu", "20.04") pkg_system_requirements(c("config", "git2r", "curl"), "ubuntu", "20.04") # queried packages must exist pkg_system_requirements("iDontExist", "ubuntu", "20.04") pkg_system_requirements(c("curl", "iDontExist"), "ubuntu", "20.04")
local_system_requirements("ubuntu", "20.04") pkg_system_requirements("pak", "ubuntu", "20.04") pkg_system_requirements("pak", "redhat", "7") pkg_system_requirements("config", "ubuntu", "20.04") # no sys reqs pkg_system_requirements("curl", "ubuntu", "20.04") pkg_system_requirements("git2r", "ubuntu", "20.04") pkg_system_requirements(c("config", "git2r", "curl"), "ubuntu", "20.04") # queried packages must exist pkg_system_requirements("iDontExist", "ubuntu", "20.04") pkg_system_requirements(c("curl", "iDontExist"), "ubuntu", "20.04")
The lock file can be used later, possibly in a new R session, to carry
out the installation of the dependencies, with
lockfile_install()
.
lockfile_create( pkg = "deps::.", lockfile = "pkg.lock", lib = NULL, upgrade = FALSE, dependencies = NA )
lockfile_create( pkg = "deps::.", lockfile = "pkg.lock", lib = NULL, upgrade = FALSE, dependencies = NA )
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
lockfile |
Path to the lock file. |
lib |
Package library to install the packages to. Note that all
dependent packages will be installed here, even if they are
already installed in another library. The only exceptions are base
and recommended packages installed in |
upgrade |
When When |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
Note, since the URLs of CRAN and most CRAN-like repositories change over time, in practice you cannot use the lock file much later. For example, binary packages of older package version might be deleted from the repository, breaking the URLs in the lock file.
Currently the intended use case of lock files in on CI systems, to facilitate caching. The (hash of the) lock file provides a good key for caching systems.
Other lock files:
lockfile_install()
Install a lock file that was created with lockfile_create()
.
lockfile_install(lockfile = "pkg.lock", lib = .libPaths()[1], update = TRUE)
lockfile_install(lockfile = "pkg.lock", lib = .libPaths()[1], update = TRUE)
lockfile |
Path to the lock file. |
lib |
Library to carry out the installation on. |
update |
Whether to online install the packages that
either not installed in |
Other lock files:
lockfile_create()
Various utilities to inspect, update and clean the metadata cache. See the pkgcache package if you need for control over the metadata cache.
meta_summary() meta_list(pkg = NULL) meta_update() meta_clean(force = FALSE)
meta_summary() meta_list(pkg = NULL) meta_update() meta_clean(force = FALSE)
pkg |
Package names, if specified then only entries for |
force |
If |
meta_summary()
returns a summary of the metadata cache.
meta_list()
lists all (or some) packages in the metadata
database.
meta_update()
updates the metadata database. You don't
normally need to call this function manually, because all pak functions
(e.g. pkg_install()
, pkg_download()
, etc.) call it automatically,
to make sure that they use the latest available metadata.
meta_clean()
deletes the whole metadata DB.
meta_summary()
returns a list with entries:
cachepath
: absolute path of the metadata cache.
current_db
: the file that contains the current metadata database.
It is currently an RDS file, but this might change in the future.
raw_files
: the files that are the downloaded PACKAGES*
files.
db_files
: all metadata database files.
size
: total size of the metadata cache.
meta_list()
returns a data frame of all available
packages in the configured repositories.
meta_update()
returns nothing.
meta_clean()
returns nothing
Metadata cache summary:
meta_summary() #> $cachepath #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata" #> #> $current_db #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/pkgs-34444e3072.rds" #> #> $raw_files #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCann-59693086a0/bin/macosx/big-sur-arm64/contrib/4.2/PACKAGES.gz" #> [2] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCann-59693086a0/src/contrib/PACKAGES.gz" #> [3] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCexp-90d4a3978b/bin/macosx/big-sur-arm64/contrib/4.2/PACKAGES.gz" #> [4] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCexp-90d4a3978b/src/contrib/PACKAGES.gz" #> [5] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCsoft-2a43920999/bin/macosx/big-sur-arm64/contrib/4.2/PACKAGES.gz" #> [6] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCsoft-2a43920999/src/contrib/PACKAGES.gz" #> [7] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCworkflows-26330ba3ca/bin/macosx/big-sur-arm64/contrib/4.2/PACKAGES.gz" #> [8] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/BioCworkflows-26330ba3ca/src/contrib/PACKAGES.gz" #> [9] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/CRAN-075c426938/bin/macosx/big-sur-arm64/contrib/4.2/PACKAGES.gz" #> [10] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/CRAN-075c426938/src/contrib/PACKAGES.gz" #> #> $db_files #> [1] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/pkgs-34444e3072.rds" #> [2] "/Users/gaborcsardi/Library/Caches/org.R-project.R/R/pkgcache/_metadata/pkgs-ccacf1b389.rds" #> #> $size #> [1] 174848200
The current metadata DB:
meta_list()
#> ✔ Loading metadata database ... done #> # A data frame: 45,279 × 32 #> package version depends sugge…¹ license imports linki…² archs enhan…³ #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 A3 1.0.0 R (>= … random… GPL (>… NA NA NA NA #> 2 AATtoo… 0.0.2 R (>= … NA GPL-3 magrit… NA NA NA #> 3 ABACUS 1.0.0 R (>= … rmarkd… GPL-3 ggplot… NA NA NA #> 4 ABC.RAP 0.9.0 R (>= … knitr,… GPL-3 graphi… NA NA NA #> 5 ABCana… 1.2.1 R (>= … NA GPL-3 plotrix NA NA NA #> 6 ABCopt… 0.15.0 NA testth… MIT + … Rcpp, … Rcpp ABCo… NA #> 7 ABCp2 1.2 MASS NA GPL-2 NA NA NA NA #> 8 ABHgen… 1.0.1 NA knitr,… GPL-3 ggplot… NA NA NA #> 9 ABPS 0.3 NA testth… GPL (>… kernlab NA NA NA #> 10 ACA 1.1 R (>= … NA GPL graphi… NA NA NA #> # … with 45,269 more rows, 23 more variables: #> # license_restricts_use <chr>, os_type <chr>, priority <chr>, #> # license_is_foss <chr>, repodir <chr>, rversion <chr>, #> # platform <chr>, needscompilation <chr>, ref <chr>, type <chr>, #> # direct <lgl>, status <chr>, target <chr>, mirror <chr>, #> # sources <list>, filesize <int>, sha256 <chr>, sysreqs <chr>, #> # built <chr>, published <dttm>, deps <list>, md5sum <chr>, …
Selected packages only:
meta_list(pkg = c("shiny", "htmlwidgets"))
#> package version depends sugge…¹ license imports linki…² archs enhan…³ #> * <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 htmlwid… 1.5.4 NA "knitr… MIT + … "grDev… NA NA shiny … #> 2 shiny 1.7.3 R (>= … "datas… GPL-3 … "utils… NA NA NA #> 3 htmlwid… 1.6.0 NA "testt… MIT + … "grDev… NA NA shiny … #> 4 shiny 1.7.4 R (>= … "datas… GPL-3 … "utils… NA NA NA #> # … with 23 more variables: license_restricts_use <chr>, os_type <chr>, #> # priority <chr>, license_is_foss <chr>, repodir <chr>, #> # rversion <chr>, platform <chr>, needscompilation <chr>, ref <chr>, #> # type <chr>, direct <lgl>, status <chr>, target <chr>, mirror <chr>, #> # sources <list>, filesize <int>, sha256 <chr>, sysreqs <chr>, #> # built <chr>, published <dttm>, deps <list>, md5sum <chr>, #> # path <chr>, and abbreviated variable names ¹suggests, ²linkingto, #> …
Update the metadata DB
meta_update()
#> ✔ Updated metadata database: 1.23 MB in 1 file. #> ✔ Updating metadata database ... done
Delete the metadata DB
meta_clean()
#> ℹ Cleaning up cache directory /Users/gaborcsardi/Library/Caches/org.R-pr #> oject.R/R/pkgcache/_metadata.
Various types of R package dependencies
R packages may have various types of dependencies, see Writing R Extensions. pak groups dependencies into three groups:
hard dependencies: "Depends", "Imports", and "LinkingTo",
soft dependencies: "Suggests" and "Enhances",
extra dependencies, see below.
pak supports concise ways of specifying which types of
dependencies of a package should be installed.
It is similar to how utils::install.packages()
interprets its
dependencies
argument.
You typically use one of these values:
NA
or "hard"
to install a package and its required dependencies,
TRUE
to install all required dependencies, plus optional and development
dependencies.
If you need more flexibility, the full description of possible values for
the dependencies
argument are:
TRUE
: This means all hard dependencies plus Suggests
for
direct installations, and hard dependencies only for dependent
packages.
FALSE
: no dependencies are installed at all.
NA
(any atomic type, so NA_character_
, etc. as well): only hard
dependencies are installed.
If a list with two entries named direct
and indirect
, it is taken
as the requested dependency types, for direct installations and
dependent packages.
If a character vector, then it is taken as the dependency types for direct installations, and the hard dependencies are used for the dependent packages.
If "hard"
is included in the value or a list element, then it is replaced
by the hard dependency types.
If "soft"
or "all"
is included, then it is replaced by all
hard and soft dependency.
pak supports extra dependency types for direct
installations not from CRAN-like repositories.
These are specified with a Config/Needs/
prefix in the DESCRIPTION
and they can contain package references, separated by commas.
For example you can specify packages that are only needed for the
pkgdown website of the package:
Config/Needs/website: r-lib/pkgdown
To use these dependency types, you need to specify them in the
dependencies
argument to
pak functions.
Note that Config/Needs/*
fields are currently not used from CRAN
packages, and packages in CRAN-like repositories in general.
Usually you specify that a Config/Needs/*
dependency type should be
installed together with "hard"
or "all"
, to install all hard or
soft dependencies as well.
Install packages from CRAN, Bioconductor, GitHub, URLs, etc. Learn how to tell pak which packages to install, and where those packages can be found.
If you want a quick overview of package sources, see "Get started with pak".
Many pkgdepends and pak functions take package names as arguments.
E.g. pak::pkg_install()
takes the names of the packages to install and
pak::pkg_deps_tree()
takes the names of the packages to draw dependency
trees for.
Most of these functions can also take more generic package references
instead of package names.
A package reference also tells pak where to find the
package source.
To specify a package source, use its name as a prefix, with a ::
separator.
E.g. cran::mypkg
means the mypkg
package from CRAN.
A package name is a special package reference that implicitly specifies
the configured CRAN(-like) repositories as the package source
(we call this the standard
package source).
So mypkg
is equivalent to standard::mypkg
and pak
looks for mypkg in any of the configured CRAN-like repositories.
If you did not explicitly specify any CRAN-like repositories (e.g. with
options("repos")
), then pak uses the CRAN and
Bioconductor repositories by default.
This is the list of the currently supported package sources.
We will discuss each in detail below.
cran
: a CRAN package.
bioc
: a Bioconductor package.
standard
: a package from a configured CRAN-like repository.
github
: a package from GitHub.
gitlab
: a package from GitLab.
git
: a package in a Git repository.
local
: a local package file or directory.
url
: an URL that points to a package archive.
installed
: an installed package.
deps
: the dependencies of a local package file or directory.
any
: a special reference type that accepts a package from any source.
See below.
param
: a special reference to change how other references are downloaded
or installed. See "Parameters" below.
To save typing, you do not always need to fully specify the package source
in a package reference.
You have seen before that a package name implicitly has a standard
package source.
Here are the complete rules for such shorthands, in the order they are
applied:
If the package reference is
a valid package name, or a package name with an @
version specification, the standard
package source is used. E.g. pkg
is
equivalent to standard::pkg
and [email protected]
is equivalent to
standard::[email protected]
.
a valid github
ref type without the github::
prefix,
then github
is used. E.g. user/repo
is equivalent to
github::user/repo
and user/repo@tag
is equivalent to
github::user/repo@tag
, etc.
a GitHub URL (see below) without the github::
prefix,
then github
is used.
a path that starts with .
or /
or \
or ~
, then
local
is used. (pak does not check if the path
exists.)
of the form <package-name>=?<parameters>
,
then it will be the special param
type. See "Parameters" below.
If the package reference does not have an explicit package source, and the package source cannot be determined from these rules, then pak throws an error.
When pak is looking up the dependencies of a package,
it needs to be able to determine the name of the dependency from the
package reference.
This is sometimes not easy for dependencies in Remotes
(or similar) fields.
For github::
and gitlab::
dependencies pak assumes
that the package name is the same as the name of the repository. If this
does not hold, then you need to specify the package name explicitly, using
a <package>=
prefix. E.g. pins=rstudio/pins-r
. To specify both the
package source type and the package name at the same time, write it like this:
pins=github::rstudio/pins-r
.
For git::
dependencies, pak assumes that the package
name is the same as the last component of the repository. If this does not
hold, then you need to specify the package name explicitly, using a
<package>=
prefix. E.g. pins=git::https://github.com/rstudio/pins-r
.
For local::
dependencies, you always need to specify the package name
explicitly. E.g. pins=local::~/works/pins
.
For url::
dependencies, you always need to specify the package name
explicitly. E.g. ggplot2=url::https://cloud.r-project.org/src/contrib/...
.
Package references may have optional parameters, added after a question
mark.
Different parameters are separated by an ampersand (&
) character.
(This is very similar to how HTTP URLs take query parameters.)
Parameters may be flags that turn on some behavior, or they can have a
string value, assigned with an equal sign (=
).
If no value is assigned, then a true
value is assumed. For example,
these two package references are equivalent:
cran::testthat?source&nocache cran::testthat?source=true&nocache=true
pak allows specifying parameters for downstream packages,
using the <package>=?<params>
special package reference, where package
is
the name of the package, and <params>
are the parameters, as above.
This is useful if you want to add a parameter to a downstream dependency.
For example, to install ggplot2, and always reinstall its cli package
dependency, you could use the ggplot2
and cli=?reinstall
package
references.
The latter tells pak to always reinstall cli, even if
it is already installed.
ignore
is a flag parameter. If specified, the package is ignored.
This usually makes sense in the packagename=?ignore
form, to ignore a
downstream soft dependency. If all versions of a hard dependency are
ignored that will lead to a solution error.
ignore-before-r
is a version number parameter. The package will be
ignored on R versions that are older than the specified one. E.g.
Matrix=?ignore-before-r=4.1.2
will ignore the Matrix package on R versions
that are older than 4.1.2. This parameter really only makes sense in the
packgename=?ignore-before-r
form.
ignore-unavailable
is a flag. It can only be specified for soft
dependencies. If specified and the package is not available, it will be
ignored. This parameter really only makes sense in the
packagename=?ignore-unavailable
form.
source
is a flag parameter. If specified, then a source R package
is requested from a CRAN-like repository. For package installations,
source
always triggers a re-install. In other words, source
implies the
reinstall
parameter. This parameter is supported for bioc::
, cran::
and standard::
remote types, and it is ignored for others.
reinstall
requests a re-install for package installations. It is
supported by the bioc::
, cran::
, git::
, github::
, gitlab::
,
local::
, standard::
, and url::
remote types.
nocache
will ignore the package cache. It will always download the
package file, and it will not add the downloaded (and built) package(s)
to the package cache. It is supported by the bioc::
, cran::
, git::
,
github::
, gitlab::
, standard::
and url::
remote types.
cran::
)A package from CRAN. Full syntax:
[cran::]<package>[@[>=]<version> | @current | @last]
<package>
is a valid package name.
<version>
is a version or a version requirement.
Examples:
forecast [email protected] forecast@>=8.8 cran::forecast forecast@last forecast@current
Note: pak currently parses the version specification part
(everything after @
), but does not use it.
bioc::
)A package from Bioconductor. The syntax is the same as for CRAN packages, except for the prefix.
[bioc::]<package>[@[>=]<version> | @current | @last]
standard::
)These are packages either from CRAN or Bioconductor, the full syntax is the same as for CRAN packages, except for the prefix:
[standard::]<package>[@[>=]<version> | current | last]
github::
)Packages from a GitHub repository. Full syntax:
[<package>=][github::]<username>/<repository>[/<subdir>][<detail>]
<package>
is the name of the package. If this is missing, then
the name of the repository is used.
<username>
is a GitHub username or organization name.
<repository>
is the name of the repository.
<subdir>
specifies an optional subdirectory, if the package is within a
subdirectory in the repository.
<detail>
specifies a certain version of the package, see below.
<detail>
may specify:
a Git branch, tag or (prefix of) a commit hash: @<commitish>
;
a pull request: #<pull-request>
; or
the latest release: @*release
.
If <detail>
is missing, then the latest commit of the default
branch is used.
Examples:
r-lib/crayon github::r-lib/crayon r-lib/crayon@84be6207 r-lib/crayon@branch r-lib/crayon#41 r-lib/crayon@release
For convenience, GitHub HTTP URLs can also be used to specify a package from GitHub. Examples:
https://github.com/r-lib/withr # A branch: https://github.com/r-lib/withr/tree/ghactions # A tag: https://github.com/r-lib/withr/tree/v2.1.1 # A commit: https://github.com/r-lib/withr/commit/8fbcb548e316 # A pull request: https://github.com/r-lib/withr/pull/76 # A release: https://github.com/r-lib/withr/releases/tag/v2.1.0
A GitHub remote string can also be used instead of a URL, for example:
[email protected]:r-lib/pak.git
gitlab::
)Packages from a GitLab repository. Full syntax:
[<package>=][gitlab::]<project-path>/<repository>[/-/<subdir>][<detail>]
<package>
is the name of the package. If this is missing, then
the name of the repository is used.
<project-path>
is typically the GitLab user or group name, but
it may contain subgroups.
<repository>
is the name of the repository, or the project in GitLab
terminology. GitLab
subgroups are
fully supported.
<subdir>
specifies an optional subdirectory, if the package is within a
subdirectory in the repository. Note that for GitLab, this must come
after a /-
prefix, to be able to distinguish it from subgroups.
<detail>
may specify a Git branch, tag or (prefix of) a commit hash.
If <detail>
is missing, then the latest commit of the default
branch is used.
gitlab::
supports Git submodules, see the git-submodules
configuration
entry.
Examples:
gitlab::gaborcsardi/cli gitlab::r-hub/filelock@main gitlab::group/subgroup/subsubgroup/project/-/subdir@ref
git::
)Full syntax:
[<package>=]git::https?://<host>[<detail>]
<package>
is the name of the package. If this is missing, then
the last component of the <host>
is used.
<host>
is the host name and path of the Git repository. Some Git
repositories need the .git
suffix here, others are more forgiving.
<detail>
specifies a certain version of the package:
a Git branch, tag or (prefix of) a commit hash: @<commitish>
.
If <detail>
is missing, then the latest commit of the default
branch is used.
git::
supports Git submodules, see the git-submodules
configuration
entry.
Examples:
git::https://github.com/r-lib/crayon git::https://github.com/r-lib/crayon.git git::https://github.com/r-lib/crayon.git@84be6207 git::https://github.com/r-lib/crayon.git@branch git::https://gitlab.com/gaborcsardi/cli.git
Note that pak has a built-in Git client, and does not require a system Git installation. If the system has Git installed, then pak will use the credentials stored in the configured Git credential store, automatically, via the gitcreds package.
local::
)A path that refers to a package file built with R CMD build
, or a
directory that contains a package. Full syntax:
local::<path>
For brevity, you can omit the local::
prefix, if you specify an
absolute path, a path from the user's home directory, starting with ~
,
or a relative path starting with ./
or .\\
.
A single dot ("."
) is considered to be a local package in the current
working directory.
Examples:
local::/foo/bar/package_1.0.0.tar.gz local::/foo/bar/pkg local::. /absolute/path/package_1.0.0.tar.gz ~/path/from/home ./relative/path .
If you specify a local package in a dependency (i.e. in DESCRIPTION
), then
you also need to specify the name of the package, see "Package names"
above.
url::
)You can use url::
to refer to URLs that hold R package archives
(i.e. properly built with R CMD build
), or compressed directories
of package trees (i.e. not built with R CMD build
). pak will
figure out if it needs to run R CMD build
on the package first.
This remote type supports .tar.gz
and .zip
files.
Note that URLs are not ideal remote types, because pak needs to
download the package file to resolve its dependencies. When this happens,
it puts the package file in the cache, so no further downloads are
needed when installing the package later.
Examples:
url::https://cloud.r-project.org/src/contrib/Archive/cli/cli_1.0.0.tar.gz url::https://github.com/tidyverse/stringr/archive/HEAD.zip
If you specify a package from a URL in a dependency (i.e. in DESCRIPTION
),
then you also need to specify the name of the package, see "Package names"
above.
installed::
)This is usually used internally, but can also be used directly. Full syntax:
installed::<path>/<package>
<path>
is the library the package is installed to.
<package>
is the package name.
Example:
installed::~/R/3.6/crayon
deps::
)Usually used internally, it specifies the dependencies of a local package. It can be used to download or install the dependencies of a package, without downloading or installing the package itself. Full syntax:
deps::<path>
Examples:
deps::/foo/bar/package_1.0.0.tar.gz deps::/foo/bar/pkg deps::.
any::
packagesSometimes you need to install additional packages, but you don't mind
where they are installed from. Here is an example. You want to install
cli from GitHub, from r-lib/cli
. You also want to install glue, and
you don't mind which version of glue is installed, as long as it is
compatible with the requested cli version. If cli specifies the
development version of glue, then that is fine. If cli is fine with the
CRAN version of glue, that's OK, too. If a future version of cli does
not depend on glue, you still want glue installed, from CRAN. The any::
reference type does exactly this.
In our example you might write
pak::pkg_install(c("glue", "r-lib/cli"))
first, but this will fail if rlib/cli
requests (say) tidyverse/glue
,
because in pkg_install()
"glue"
is interpreted as "standard::glue"
,
creating a conflict with tidyverse/glue
. On the other hand
pak::pkg_install(c("any::glue", "r-lib/cli"))
works, independently of which glue version is requested by cli.
param::
)See "Parameters" above.
Remotes
fieldIn the DESCRIPTION
file of an R package you can mark any regular
dependency defined in the Depends
, Imports
, Suggests
or Enhances
fields as being installed from a non-standard package source by adding
a package reference to a Remotes
entry.
pak will download and install the package from the
specified location, instead of a CRAN-like repository.
The remote dependencies specified in Remotes
are a comma separated
list of package sources:
Remotes: <pkg-source-1>, <pkg-source-2>, [ ... ]
Note that you will still need to add the package to one of the regular
dependency fields, i.e. Imports
, Suggests
, etc. Here is a concrete
example that specifies the r-lib/glue
package:
Imports: glue Remotes: r-lib/glue, r-lib/[email protected], klutometis/roxygen#142, r-lib/testthat@c67018fa4970
The CRAN and Bioconductor repositories do not support the Remotes
field, so you need to remove this field, before submitting your package
to either of them.
Install the specified packages, or the ones required by the package or project in the current working directory.
pak(pkg = NULL, ...)
pak(pkg = NULL, ...)
pkg |
Package names or remote package specifications to install.
See pak package sources for details. If |
... |
Extra arguments are passed to |
This is a convenience function:
If you want to install some packages, it is easier to type
than pkg_install()
.
If you want to install all the packages that are needed
for the development of a package or project, then it is
easier to type than local_install_dev_deps()
.
You don't need to remember two functions to install packages, just one.
Other package functions:
lib_status()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
Other local package trees:
local_deps_explain()
,
local_deps()
,
local_install_deps()
,
local_install_dev_deps()
,
local_install()
,
local_package_trees
pak behavior can be finetuned with environment variables and
options (as in base::options()
).
Ncpus
Set to the desired number of worker processes for package installation. If not set, then pak will use the number of logical processors in the machine.
repos
The CRAN-like repositories to use. See base::options()
for details.
Configuration entries (unless noted otherwise on this manual page) have a corresponding environment variable, and a corresponding option.
The environment variable is always uppercase and uses underscores as the
word separator. It always has the PKG_
prefix.
The option is typically lowercase, use it uses underscores as the word
separator, but it always has the pkg.
prefix (notice the dot!).
Some examples:
Config entry name | Env var name | Option name |
platforms | PKG_PLATFORMS |
pkg.platforms |
cran_mirror | PKG_CRAN_MIRROR |
pkg.cran_mirror |
‘build_vignettes’: (Env var: PKG_BUILD_VIGNETTES
, option: pkg.build_vignettes
.) Whether to build vignettes for package trees.
This is only used if the package is obtained from a package tree,
and not from a source (or binary) package archive. By default
vignettes are not built in this case. If you set this to TRUE
,
then you need to make sure that the vignette builder packages are
available, as these are not installed by default currently.
‘cache_dir’: (Env var: PKG_CACHE_DIR
, option: pkg.cache_dir
.) Directory to download the packages to. Defaults to a temporary
directory within the R session temporary directory, see
base::tempdir()
.
‘cran_mirror’: (Env var: PKG_CRAN_MIRROR
, option: pkg.cran_mirror
.) CRAN mirror to use. Defaults to the repos
option
(see base::options()
), if that's not set then
https://cran.rstudio.com
. See also pak::repo_add()
and
pak::repo_get()
‘git_submodules’: (Env var: PKG_GIT_SUBMODULES
, option: pkg.git_submodules
.) Whether or not to update submodules in git repositories. This
affects git::
and gitlab::
package sources only.
If the R package is in a subdirectory then only the submodules
within that directory are updated. If a submodule appears in
.Rbuildignore
, then it is skipped.
‘include_linkingto’: (Env var: PKG_INCLUDE_LINKINGTO
, option: pkg.include_linkingto
.) Whether to always include LinkingTo
dependencies in the solution
of and installation, even if they are needed because the packages
are installed from binaries. This is sometimes useful, see e.g.
https://github.com/r-lib/pak/issues/485 for an example use case.
‘library’: (Env var: PKG_LIBRARY
, option: pkg.library
.) Package library to install packages to. It is also used for
already installed packages when considering dependencies.
‘metadata_cache_dir’: (Env var: PKG_METADATA_CACHE_DIR
, option: pkg.metadata_cache_dir
.) Location of metadata replica of
pkgcache::cranlike_metadata_cache
. Defaults to a temporary
directory within the R session temporary directory, see
base::tempdir()
.
‘metadata_update_after’: (Env var: PKG_METADATA_UPDATE_AFTER
, option: pkg.metadata_update_after
.) A time interval as a difftime object. pak will update the
metadata cache if it is older than this. The default is one day.
The PKG_METADATA_UPDATE_AFTER
environment variable may be set
in seconds (s
suffix), minutes (m
suffix), hours (h
suffix),
or days (d
suffix). E.g: 1d
means one day.
‘package_cache_dir’: (Env var: PKG_PACKAGE_CACHE_DIR
, option: pkg.package_cache_dir
.) Location of the package cache on the disk. See
pak::cache_summary()
. Default is selected by pkgcache.
‘platforms’: (Env var: PKG_PLATFORMS
, option: pkg.platforms
.) Character vector of platforms to download or install packages
for. See pkgdepends::default_platforms()
for possible platform
names. Defaults to the platform of the current R session, plus
"source"
.
‘r_versions’: (Env var: PKG_R_VERSIONS
, option: pkg.r_versions
.) Character vector, R versions to download or install
packages for. It defaults to the current R version.
‘sysreqs’: (Env var: PKG_SYSREQS
, option: pkg.sysreqs
.) Whether to automatically look up and install system requirements.
If TRUE
, then pkgdepends will try to install required
system packages. If FALSE
, then system requirements are still
printed (including OS packages on supported platforms), but they
are not installed.
By default it is TRUE
on supported platforms,
if the current user is the root user or password-less sudo
is
configured for the current user.
‘sysreqs_db_update’: (Env var: PKG_SYSREQS_DB_UPDATE
, option: pkg.sysreqs_db_update
.) Whether to try to update the system requirements database from
GitHub. If the update fails, then the cached or the build-in
database if used. Defaults to TRUE.
‘sysreqs_db_update_timeout’: (Env var: PKG_SYSREQS_DB_UPDATE_TIMEOUT
, option: pkg.sysreqs_db_update_timeout
.) Timeout for the system requirements database update.
Defaults to five seconds.
‘sysreqs_dry_run’: (Env var: PKG_SYSREQS_DRY_RUN
, option: pkg.sysreqs_dry_run
.) If TRUE
, then pak only prints the system commands to
install system requirements, but does not execute them.
‘sysreqs_platform’: (Env var: PKG_SYSREQS_PLATFORM
, option: pkg.sysreqs_platform
.) The platform to use for system requirements lookup. On Linux, where
system requirements are currently supported, it must be a string
containing the distribution name and release, separated by a dash.
E.g.: "ubuntu-22.04"
, or "rhel-9"
.
‘sysreqs_rspm_repo_id’: (Env var: PKG_SYSREQS_RSPM_REPO_ID
, option: pkg.sysreqs_rspm_repo_id
.) Posit Package Manager (formerly RStudio Package Manager) repository
id to use for CRAN system requirements lookup. Defaults to the
RSPM_REPO_ID
environment variable, if set. If not set, then it
defaults to 1
.
‘sysreqs_rspm_url’: (Env var: PKG_SYSREQS_RSPM_URL
, option: pkg.sysreqs_rspm_url
.) Root URL of Posit Package Manager (formerly RStudio Package
Manager) for system requirements lookup. By default the RSPM_ROOT
environment variable is used, if set. If not set,
it defaults to https://packagemanager.posit.co
.
‘sysreqs_sudo’: (Env var: PKG_SYSREQS_SUDO
, option: pkg.sysreqs_sudo
.) Whether to use sudo
to install system requirements,
on Unix. By default it is TRUE
on Linux if the effective user id
of the current process is not the root
user.
‘sysreqs_update’: (Env var: PKG_SYSREQS_UPDATE
, option: pkg.sysreqs_update
.) Whether to try to update system packages that are already installed.
It defaults to TRUE
on CI systems: if the CI
environment
variable is set to true
.
‘sysreqs_verbose’: (Env var: PKG_SYSREQS_VERBOSE
, option: pkg.sysreqs_verbose
.) Whether to echo the output of system requirements installation.
Defaults to TRUE
if the CI
environment variable is set.
‘use_bioconductor’: (Env var: PKG_USE_BIOCONDUCTOR
, option: pkg.use_bioconductor
.) Whether to automatically use the Bioconductor repositories.
Defaults to TRUE
.
‘windows_archs’: (Env var: PKG_WINDOWS_ARCHS
, option: pkg.windows_archs
.) Character scalar specifying which architectures
to download/install for on Windows. Its possible values are:
"prefer-x64"
: Generally prefer x64 binaries. If the current R
session is x64
, then we download/install x64 packages.
(These packages might still be multi-architecture binaries!)
If the current R session is i386
, then we download/install
packages for both architectures. This might mean compiling
packages from source if the binary packages are for x64
only,
like the CRAN Windows binaries for R 4.2.x currently.
"prefer-x64"
is the default for R 4.2.0 and later.
"both"
: Always download/install packages for both i386
and
x64
architectures. This might need compilation from source
if the available binaries are for x64
only, like the CRAN
Windows binaries for R 4.2.x currently. "both"
is the default
for R 4.2.0 and earlier.
From version 0.4.0 pak copies the PKG_*
environment variables and
the pkg.*
options to the pak subprocess, where they are actually
used, so you don't need to restart R or reaload pak after a
configuration change.
Clean up pak caches
pak_cleanup( package_cache = TRUE, metadata_cache = TRUE, pak_lib = TRUE, force = FALSE )
pak_cleanup( package_cache = TRUE, metadata_cache = TRUE, pak_lib = TRUE, force = FALSE )
package_cache |
Whether to clean up the cache of package files. |
metadata_cache |
Whether to clean up the cache of package meta data. |
pak_lib |
This argument is now deprecated and does nothing. |
force |
Do not ask for confirmation. Note that to use this function
in non-interactive mode, you have to specify |
Other pak housekeeping:
pak_sitrep()
These packages are not required for any pak functionality. They are recommended for some functions that return values that are best used with these packages. E.g. many functions return data frames, which print nicer when the pillar package is available.
pak_install_extra(upgrade = FALSE)
pak_install_extra(upgrade = FALSE)
upgrade |
Whether to install or upgrade to the latest versions of the optional packages. |
Currently only one package is optional: pillar.
This function is deprecated and does nothing.
Recent versions of pak do not need a pak_setup()
call.
pak_setup(mode = c("auto", "download", "copy"), quiet = FALSE)
pak_setup(mode = c("auto", "download", "copy"), quiet = FALSE)
mode |
Where to get the packages from. "download" will try to download them from CRAN. "copy" will try to copy them from your current "regular" package library. "auto" will try to copy first, and if that fails, then it tries to download. |
quiet |
Whether to omit messages. |
The path to the private library, invisibly.
It prints
pak version,
platform the package was built on, and the current platform,
the current library path,
versions of dependencies,
whether dependencies can be loaded.
pak_sitrep()
pak_sitrep()
pak_sitrep()
#> compatible) #> - pak repository: - (local install?) #> * Optional packages installed: #> - pillar #> * Library path: #> - /private/var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T/RtmpRxl7Vu/fi #> le1868066d6ae59 #> - /private/var/folders/ph/fpcmzfd16rgbbk8mxvy9m2_h0000gn/T/RtmpRxl7Vu/fi #> le186806281b34a #> - /Users/gaborcsardi/Library/R/arm64/4.3/library #> - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library #> * Private library location: #> - /Users/gaborcsardi/Library/Caches/org.R-project.R/R/pak/lib/4.3/aarch6 #> 4 #> * Private library exists. #> * Private library is functional
Other pak housekeeping:
pak_cleanup()
Use this function to update the released or development version of pak.
pak_update(force = FALSE, stream = c("auto", "stable", "rc", "devel"))
pak_update(force = FALSE, stream = c("auto", "stable", "rc", "devel"))
force |
Whether to force an update, even if no newer version is available. |
stream |
Whether to update to the
Often there is no release candidate version, then |
Nothing.
Look up the dependencies of a package
pkg_deps(pkg, upgrade = TRUE, dependencies = NA)
pkg_deps(pkg, upgrade = TRUE, dependencies = NA)
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
upgrade |
Whether to use the most recent available package versions. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
A data frame with the dependency data, it includes pkg
as well. It has the following columns.
built
: the Built
field from the DESCRIPTION
file of binary
packages, for which this information is available.
cache_status
: whether the package file is in the package cache.
It is NA
for installed::
package refs.
dep_types
: character vector of dependency types that were
considered for this package. (This is a list column.)
deps
: dependencies of the package, in a data frame. See
"Package dependency tables" below.
direct
: whether this package (ref, really) was directly specified,
or added as a dependency.
error
: this is a list column that contains error objects for the
refs that pkgdepends failed to resolve.
filesize
: the file size in bytes, or NA
if this information is
not available.
license
: license of the package, or NA
if not available.
md5sum
: MD5 checksum of the package file, if available, or NA
if
not.
metadata
: a named character vector. These fields will be (should be)
added to the installed DESCRIPTION
file of the package.
mirror
: URL of the CRAN(-like) mirror site where the metadata was
obtained from. It is NA for non-CRAN-like sources, e.g. local files,
installed packages, GitHub, etc.
needscompilation
: whether the package needs compilation.
package
: package name.
priority
: this is "base"
for base packages, "recommended"
for
recommended packages, and NA
otherwise.
ref
: package reference.
remote
: the parsed remote_ref
objects, see parse_pkg_refs()
.
This is a list column.
repodir
: the directory where this package should be in a CRAN-like
repository.
sha256
: SHA256 hash of the package file, if available, otherwise
NA
.
sources
: URLs where this package can be downloaded from. This is not
necessarily a URL that you can download with a HTTP client. E.g. for
local::
refs it is a path, and for git::
refs it is a URL for git.
It is a zero length vector for installed::
refs.
status
: status of the dependency resolution, "OK"
or "FAILED"
.
target
: path where this package should be saved in a CRAN-repository.
type
: ref type.
version
: package version.
Additional columns might be present. They are either used internally or
they are experimental. They might be removed or changed at any time.
All columns are of type character, except for direct
(logical),
needscompilation
(logical), filesize
(integer), deps
(list column, see
"Package dependency tables" below), sources
(list of character vectors),
remote
(list), error
(list), metadata
(list), dep_types
(list).
A package dependency tables in the deps
list column have five columns
currently:
ref
: the package ref of the dependency.
type
: the dependency type, in all lowercase. I.e. imports
,
suggests
, etc.
package
: package name of the dependency.
op
: operator for version requirements, e.g. >=
.
version
: version number, for version requirements.
pkg_deps("dplyr")
#> # A data frame: 16 × 32 #> ref type direct direc…¹ status package version license needs…² #> <chr> <chr> <lgl> <lgl> <chr> <chr> <chr> <chr> <lgl> #> 1 R6 stan… FALSE FALSE OK R6 2.5.1 MIT + … FALSE #> 2 cli stan… FALSE FALSE OK cli 3.4.1 MIT + … FALSE #> 3 dplyr stan… TRUE TRUE OK dplyr 1.0.10 MIT + … FALSE #> 4 fansi stan… FALSE FALSE OK fansi 1.0.3 GPL-2 … FALSE #> 5 generics stan… FALSE FALSE OK generi… 0.1.3 MIT + … FALSE #> 6 glue stan… FALSE FALSE OK glue 1.6.2 MIT + … FALSE #> 7 lifecycle stan… FALSE FALSE OK lifecy… 1.0.3 MIT + … FALSE #> 8 magrittr stan… FALSE FALSE OK magrit… 2.0.3 MIT + … FALSE #> 9 pillar stan… FALSE FALSE OK pillar 1.8.1 MIT + … FALSE #> 10 pkgconfig stan… FALSE FALSE OK pkgcon… 2.0.3 MIT + … FALSE #> 11 rlang stan… FALSE FALSE OK rlang 1.0.6 MIT + … FALSE #> 12 tibble stan… FALSE FALSE OK tibble 3.1.8 MIT + … FALSE #> 13 tidysele… stan… FALSE FALSE OK tidyse… 1.2.0 MIT + … FALSE #> 14 utf8 stan… FALSE FALSE OK utf8 1.2.2 Apache… FALSE #> 15 vctrs stan… FALSE FALSE OK vctrs 0.5.1 MIT + … FALSE #> 16 withr stan… FALSE FALSE OK withr 2.5.0 MIT + … FALSE #> # … with 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>, #> # filesize <int>, built <chr>, platform <chr>, rversion <chr>, #> # repotype <chr>, repodir <chr>, target <chr>, deps <list>, #> # mirror <chr>, sources <list>, remote <list>, error <list>, #> # metadata <list>, dep_types <list>, params <list>, sysreqs <chr>, #> # cache_status <chr>, lib_status <chr>, old_version <chr>, #> # new_version <chr>, and abbreviated variable names ¹directpkg, …
For a package on GitHub:
pkg_deps("r-lib/callr")
#> # A data frame: 4 × 32 #> ref type direct direc…¹ status package version license needs…² #> <chr> <chr> <lgl> <lgl> <chr> <chr> <chr> <chr> <lgl> #> 1 r-lib/cal… gith… TRUE TRUE OK callr 3.7.3.… MIT + … TRUE #> 2 R6 stan… FALSE FALSE OK R6 2.5.1 MIT + … FALSE #> 3 processx stan… FALSE FALSE OK proces… 3.8.0 MIT + … FALSE #> 4 ps stan… FALSE FALSE OK ps 1.7.2 MIT + … FALSE #> # … with 23 more variables: priority <chr>, md5sum <chr>, sha256 <chr>, #> # filesize <int>, built <chr>, platform <chr>, rversion <chr>, #> # repotype <chr>, repodir <chr>, target <chr>, deps <list>, #> # mirror <chr>, sources <list>, remote <list>, error <list>, #> # metadata <list>, dep_types <list>, params <list>, sysreqs <chr>, #> # cache_status <chr>, lib_status <chr>, old_version <chr>, #> # new_version <chr>, and abbreviated variable names ¹directpkg, …
Other package functions:
lib_status()
,
pak()
,
pkg_deps_tree()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
Extract dependency chains from pkg
to deps
.
pkg_deps_explain(pkg, deps, upgrade = TRUE, dependencies = NA)
pkg_deps_explain(pkg, deps, upgrade = TRUE, dependencies = NA)
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
deps |
Package names of the dependencies to explain. |
upgrade |
Whether to use the most recent available package versions. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
This function is similar to pkg_deps_tree()
, but its output is easier
to read if you are only interested is certain packages (deps
).
A named list with a print method. First entries are the
function arguments: pkg
, deps
, dependencies
, the last one is
paths
and it contains the results in a named list, the names are
the package names in deps
.
How does dplyr depend on rlang?
pkg_deps_explain("dplyr", "rlang")
#> ✔ Updated metadata database: 5.09 MB in 12 files. #> ✔ Updating metadata database ... done #> dplyr -> lifecycle -> rlang #> dplyr -> rlang #> dplyr -> tibble -> lifecycle -> rlang #> dplyr -> tibble -> pillar -> lifecycle -> rlang #> dplyr -> tibble -> pillar -> rlang #> dplyr -> tibble -> pillar -> vctrs -> lifecycle -> rlang #> dplyr -> tibble -> pillar -> vctrs -> rlang #> dplyr -> tibble -> rlang #> dplyr -> tibble -> vctrs -> lifecycle -> rlang #> dplyr -> tibble -> vctrs -> rlang #> dplyr -> tidyselect -> lifecycle -> rlang #> dplyr -> tidyselect -> rlang #> dplyr -> tidyselect -> vctrs -> lifecycle -> rlang #> dplyr -> tidyselect -> vctrs -> rlang #> dplyr -> vctrs -> lifecycle -> rlang #> dplyr -> vctrs -> rlang #> dplyr -> pillar -> lifecycle -> rlang #> dplyr -> pillar -> rlang #> dplyr -> pillar -> vctrs -> lifecycle -> rlang #> dplyr -> pillar -> vctrs -> rlang
How does the GH version of usethis depend on cli and ps?
pkg_deps_explain("r-lib/usethis", c("cli", "ps"))
#> usethis -> cli #> usethis -> desc -> cli #> usethis -> gh -> cli #> usethis -> lifecycle -> cli #> #> x ps
Draw the dependency tree of a package
pkg_deps_tree(pkg, upgrade = TRUE, dependencies = NA)
pkg_deps_tree(pkg, upgrade = TRUE, dependencies = NA)
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
upgrade |
Whether to use the most recent available package versions. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
The same data frame as pkg_deps()
, invisibly.
pkg_deps_tree("dplyr")
#> dplyr 1.0.10 ✨ #> ├─generics 0.1.3 ✨ #> ├─glue 1.6.2 ✨ #> ├─lifecycle 1.0.3 ✨ #> │ ├─cli 3.4.1 ✨ #> │ ├─glue #> │ └─rlang 1.0.6 ✨ #> ├─magrittr 2.0.3 ✨ #> ├─R6 2.5.1 ✨ #> ├─rlang #> ├─tibble 3.1.8 ✨ #> │ ├─fansi 1.0.3 ✨ #> │ ├─lifecycle #> │ ├─magrittr #> │ ├─pillar 1.8.1 ✨ #> │ │ ├─cli #> │ │ ├─fansi #> │ │ ├─glue #> │ │ ├─lifecycle #> │ │ ├─rlang #> │ │ ├─utf8 1.2.2 ✨ #> │ │ └─vctrs 0.5.1 ✨ #> │ │ ├─cli #> │ │ ├─glue #> │ │ ├─lifecycle #> │ │ └─rlang #> │ ├─pkgconfig 2.0.3 ✨ #> │ ├─rlang #> │ └─vctrs #> ├─tidyselect 1.2.0 ✨ #> │ ├─cli #> │ ├─glue #> │ ├─lifecycle #> │ ├─rlang #> │ ├─vctrs #> │ └─withr 2.5.0 ✨ #> ├─vctrs #> └─pillar #> #> Key: ✨ new
pkg_deps_tree("r-lib/usethis")
#> r-lib/usethis 2.1.6.9000 ✨👷🏼🔧 #> ├─cli 3.4.1 ✨ #> ├─clipr 0.8.0 ✨ #> ├─crayon 1.5.2 ✨ #> ├─curl 4.3.3 ✨ #> ├─desc 1.4.2 ✨ #> │ ├─cli #> │ ├─R6 2.5.1 ✨ #> │ └─rprojroot 2.0.3 ✨ #> ├─fs 1.5.2 ✨ #> ├─gert 1.9.2 ✨ ⬇ (1.91 MB) #> │ ├─askpass 1.1 ✨ #> │ │ └─sys 3.4.1 ✨ #> │ ├─credentials 1.3.2 ✨ ⬇ (170.15 kB) #> │ │ ├─openssl 2.0.5 ✨ #> │ │ │ └─askpass #> │ │ ├─sys #> │ │ ├─curl #> │ │ ├─jsonlite 1.8.4 ✨ #> │ │ └─askpass #> │ ├─openssl #> │ ├─rstudioapi 0.14 ✨ #> │ ├─sys #> │ └─zip 2.2.2 ✨ #> ├─gh 1.3.1 ✨ ⬇ (95.20 kB) #> │ ├─cli #> │ ├─gitcreds 0.1.2 ✨ ⬇ (95.59 kB) #> │ ├─httr 1.4.4 ✨ #> │ │ ├─curl #> │ │ ├─jsonlite #> │ │ ├─mime 0.12 ✨ #> │ │ ├─openssl #> │ │ └─R6 #> │ ├─ini 0.3.1 ✨ ⬇ (13.13 kB) #> │ └─jsonlite #> ├─glue 1.6.2 ✨ #> ├─jsonlite #> ├─lifecycle 1.0.3 ✨ #> │ ├─cli #> │ ├─glue #> │ └─rlang 1.0.6 ✨ #> ├─purrr 0.3.5 ✨ #> │ ├─magrittr 2.0.3 ✨ #> │ └─rlang #> ├─rappdirs 0.3.3 ✨ #> ├─rlang #> ├─rprojroot #> ├─rstudioapi #> ├─whisker 0.4.1 ✨ ⬇ (65.36 kB) #> ├─withr 2.5.0 ✨ #> └─yaml 2.3.6 ✨ #> #> Key: ✨ new | ⬇ download | 👷🏼 build | 🔧 compile
Other package functions:
lib_status()
,
pak()
,
pkg_deps()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
TODO: explain result
pkg_download( pkg, dest_dir = ".", dependencies = FALSE, platforms = NULL, r_versions = NULL )
pkg_download( pkg, dest_dir = ".", dependencies = FALSE, platforms = NULL, r_versions = NULL )
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
dest_dir |
Destination directory for the packages. If it does not exist, then it will be created. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
platforms |
Types of binary or source packages to download. The
default is the value of |
r_versions |
R version(s) to download packages for. (This does not matter for source packages, but it does for binaries.) It defaults to the current R version. |
Data frame with information about the downloaded packages, invisibly. Columns:
built
: the Built
field from the DESCRIPTION
file of binary
packages, for which this information is available.
cache_status
: whether the package file is in the package cache.
It is NA
for installed::
package refs.
dep_types
: character vector of dependency types that were
considered for this package. (This is a list column.)
deps
: dependencies of the package, in a data frame. See
"Package dependency tables" below.
direct
: whether this package (ref, really) was directly specified,
or added as a dependency.
error
: this is a list column that contains error objects for the
refs that pkgdepends failed to resolve.
filesize
: the file size in bytes, or NA
if this information is
not available.
license
: license of the package, or NA
if not available.
md5sum
: MD5 checksum of the package file, if available, or NA
if
not.
metadata
: a named character vector. These fields will be (should be)
added to the installed DESCRIPTION
file of the package.
mirror
: URL of the CRAN(-like) mirror site where the metadata was
obtained from. It is NA for non-CRAN-like sources, e.g. local files,
installed packages, GitHub, etc.
needscompilation
: whether the package needs compilation.
package
: package name.
priority
: this is "base"
for base packages, "recommended"
for
recommended packages, and NA
otherwise.
ref
: package reference.
remote
: the parsed remote_ref
objects, see parse_pkg_refs()
.
This is a list column.
repodir
: the directory where this package should be in a CRAN-like
repository.
sha256
: SHA256 hash of the package file, if available, otherwise
NA
.
sources
: URLs where this package can be downloaded from. This is not
necessarily a URL that you can download with a HTTP client. E.g. for
local::
refs it is a path, and for git::
refs it is a URL for git.
It is a zero length vector for installed::
refs.
status
: status of the dependency resolution, "OK"
or "FAILED"
.
target
: path where this package should be saved in a CRAN-repository.
type
: ref type.
version
: package version.
fulltarget
: absolute path to the downloaded file. At most one of
fulltarget
and fulltarget_tree
must exist on the disk.
fulltarget_tree
: absolute path to a package tree directory. At most
one of fulltarget
and fulltarget_tree
must exist on the disk.
download_status
: "Had"
or "Got"
, depending on whether the file
was obtained from the cache.
download_error
: error object for failed downloads.
file_size
: Size of the file, or NA
. For installed::
refs, it is
NA
, and it is also NA
for refs that created fulltarget_tree
instead of fulltarget
.
fulltarget
, if it exists, contains a packaged (via R CMD build
)
source R package. If fulltarget_tree
exists, it is a package tree
directory, that still needs an R CMD build
call.
Additional columns might be present. They are either used internally or
they are experimental. They might be removed or changed at any time.
All columns are of type character, except for direct
(logical),
needscompilation
(logical), filesize
(integer), deps
(list column, see
"Package dependency tables" below), sources
(list of character vectors),
remote
(list), error
(list), metadata
(list), dep_types
(list).
A package dependency tables in the deps
list column have five columns
currently:
ref
: the package ref of the dependency.
type
: the dependency type, in all lowercase. I.e. imports
,
suggests
, etc.
package
: package name of the dependency.
op
: operator for version requirements, e.g. >=
.
version
: version number, for version requirements.
dl <- pkg_download("forcats")
#> ℹ No downloads are needed, 2 pkgs (641.53 kB) are cached
dl
#> # A data frame: 2 × 35 #> ref type direct direc…¹ status package version license needs…² #> <chr> <chr> <lgl> <lgl> <chr> <chr> <chr> <chr> <lgl> #> 1 forcats standard TRUE TRUE OK forcats 0.5.2 MIT + … FALSE #> 2 forcats standard TRUE TRUE OK forcats 0.5.2 MIT + … FALSE #> # … with 26 more variables: priority <chr>, md5sum <chr>, sha256 <chr>, #> # filesize <int>, built <chr>, platform <chr>, rversion <chr>, #> # repotype <chr>, repodir <chr>, target <chr>, deps <list>, #> # mirror <chr>, sources <list>, remote <list>, error <list>, #> # metadata <list>, extra <list>, dep_types <list>, params <list>, #> # sysreqs <chr>, cache_status <chr>, fulltarget <chr>, #> # fulltarget_tree <chr>, download_status <chr>, …
dl$fulltarget
#> [1] "./bin/macosx/big-sur-arm64/contrib/4.2/forcats_0.5.2.tgz" #> [2] "./src/contrib/forcats_0.5.2.tar.gz"
pkg_download("r-lib/pak", platforms = "source")
#> ℹ No downloads are needed, 1 pkg is cached
Other package functions:
lib_status()
,
pak()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
Query the history of a CRAN package
pkg_history(pkg)
pkg_history(pkg)
pkg |
Package name. |
A data frame, with one row per package version. The columns are
the entries of the DESCRIPTION
files in the released package
versions.
pkg_history("ggplot2")
#> # A data frame: 44 × 30 #> Package Type Title Version Date Author Maint…¹ Descr…² License #> * <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 ggplot2 Package An impl… 0.5 2007… Hadle… Hadley… "An im… GPL #> 2 ggplot2 Package An impl… 0.5.1 2007… Hadle… Hadley… "An im… GPL #> 3 ggplot2 Package An impl… 0.5.2 2007… Hadle… Hadley… "An im… GPL #> 4 ggplot2 Package An impl… 0.5.4 2007… Hadle… Hadley… "An im… GPL #> 5 ggplot2 Package An impl… 0.5.5 2007… Hadle… Hadley… "An im… GPL #> 6 ggplot2 Package An impl… 0.5.6 2007… Hadle… Hadley… "An im… GPL #> 7 ggplot2 Package An impl… 0.5.7 2007… Hadle… Hadley… "An im… GPL #> 8 ggplot2 Package An impl… 0.6 2008… Hadle… Hadley… "An im… GPL #> 9 ggplot2 Package An impl… 0.7 2008… Hadle… Hadley… "An im… GPL #> 10 ggplot2 Package An impl… 0.8 2008… Hadle… Hadley… "An im… GPL #> # … with 34 more rows, 21 more variables: SaveImage <chr>, #> # LazyData <chr>, Packaged <chr>, crandb_file_date <chr>, date <chr>, #> # dependencies <list>, URL <chr>, LazyLoad <chr>, Extends <chr>, #> # Collate <chr>, Repository <chr>, `Date/Publication` <chr>, #> # NeedsCompilation <chr>, VignetteBuilder <chr>, BugReports <chr>, #> # `Authors@R` <chr>, RoxygenNote <chr>, Encoding <chr>, MD5sum <chr>, #> # `Config/Needs/website` <chr>, `Config/testthat/edition` <chr>, …
Install one or more packages and their dependencies into a single package library.
pkg_install( pkg, lib = .libPaths()[[1L]], upgrade = FALSE, ask = interactive(), dependencies = NA )
pkg_install( pkg, lib = .libPaths()[[1L]], upgrade = FALSE, ask = interactive(), dependencies = NA )
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
lib |
Package library to install the packages to. Note that all
dependent packages will be installed here, even if they are
already installed in another library. The only exceptions are base
and recommended packages installed in |
upgrade |
When When |
ask |
Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation. |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
(Invisibly) A data frame with information about the installed package(s).
pkg_install("dplyr")
#> #> → Will install 5 packages. #> → All 5 packages (2.14 MB) are cached. #> + dplyr 1.0.9 #> + generics 0.1.2 #> + purrr 0.3.4 #> + R6 2.5.1 #> + tidyselect 1.1.2 #> ℹ No downloads are needed, 5 pkgs (2.14 MB) are cached #> ✔ Got R6 2.5.1 (aarch64-apple-darwin20) (82.52 kB) #> ✔ Installed R6 2.5.1 (43ms) #> ✔ Installed generics 0.1.2 (62ms) #> ✔ Installed dplyr 1.0.9 (88ms) #> ✔ Installed purrr 0.3.4 (88ms) #> ✔ Installed tidyselect 1.1.2 (94ms) #> ✔ 1 pkg + 17 deps: kept 12, added 5, dld 1 (82.52 kB) [1.2s]
Upgrade dplyr and all its dependencies:
pkg_install("dplyr", upgrade = TRUE)
#> #> → Will update 1 package. #> → The package (742.51 kB) is cached. #> + rlang 1.0.2 → 1.0.3 👷🏿♀️🔧 #> ℹ No downloads are needed, 1 pkg (742.51 kB) is cached #> ℹ Building rlang 1.0.3 #> ✔ Built rlang 1.0.3 (5.8s) #> ✔ Installed rlang 1.0.3 (32ms) #> ✔ 1 pkg + 17 deps: kept 17, upd 1 [6.3s]
Install the development version of dplyr:
pkg_install("tidyverse/dplyr")
#> ✔ Loading metadata database ... done #> #> → Will install 16 packages. #> → All 16 packages (8.09 MB) are cached. #> + cli 3.4.1 #> + dplyr 1.0.99.9000 👷🏾♂️🔧 (GitHub: e6252f8) #> + fansi 1.0.3 #> + generics 0.1.3 #> + glue 1.6.2 #> + lifecycle 1.0.3 #> + magrittr 2.0.3 #> + pillar 1.8.1 #> + pkgconfig 2.0.3 #> + R6 2.5.1 #> + rlang 1.0.6 #> + tibble 3.1.8 #> + tidyselect 1.2.0 #> + utf8 1.2.2 #> + vctrs 0.5.1 #> + withr 2.5.0 #> ℹ No downloads are needed, 16 pkgs (8.09 MB) are cached #> ✔ Installed R6 2.5.1 (58ms) #> ✔ Installed cli 3.4.1 (69ms) #> ✔ Installed fansi 1.0.3 (92ms) #> ✔ Installed generics 0.1.3 (99ms) #> ✔ Installed glue 1.6.2 (108ms) #> ✔ Installed lifecycle 1.0.3 (144ms) #> ✔ Installed magrittr 2.0.3 (152ms) #> ✔ Installed pillar 1.8.1 (160ms) #> ✔ Installed pkgconfig 2.0.3 (63ms) #> ✔ Installed rlang 1.0.6 (37ms) #> ✔ Installed tibble 3.1.8 (41ms) #> ✔ Installed tidyselect 1.2.0 (38ms) #> ✔ Installed utf8 1.2.2 (36ms) #> ✔ Installed vctrs 0.5.1 (39ms) #> ✔ Installed withr 2.5.0 (30ms) #> ℹ Packaging dplyr 1.0.99.9000 #> ✔ Packaged dplyr 1.0.99.9000 (8.3s) #> ℹ Building dplyr 1.0.99.9000 #> ✔ Built dplyr 1.0.99.9000 (5.2s) #> ✔ Installed dplyr 1.0.99.9000 (github::tidyverse/dplyr@e6252f8) (24ms) #> ✔ 1 pkg + 15 deps: added 16 [18.9s]
Switch back to the CRAN version. This will be fast because pak will have cached the prior install.
pkg_install("dplyr")
#> ✔ Updated metadata database: 2.43 MB in 6 files. #> ✔ Updating metadata database ... done #> #> → Will install 16 packages. #> → All 16 packages (9.42 MB) are cached. #> + cli 3.4.1 #> + dplyr 1.0.10 #> + fansi 1.0.3 #> + generics 0.1.3 #> + glue 1.6.2 #> + lifecycle 1.0.3 #> + magrittr 2.0.3 #> + pillar 1.8.1 #> + pkgconfig 2.0.3 #> + R6 2.5.1 #> + rlang 1.0.6 #> + tibble 3.1.8 #> + tidyselect 1.2.0 #> + utf8 1.2.2 #> + vctrs 0.5.1 #> + withr 2.5.0 #> ℹ No downloads are needed, 16 pkgs (9.42 MB) are cached #> ✔ Installed R6 2.5.1 (66ms) #> ✔ Installed cli 3.4.1 (76ms) #> ✔ Installed dplyr 1.0.10 (111ms) #> ✔ Installed fansi 1.0.3 (119ms) #> ✔ Installed generics 0.1.3 (125ms) #> ✔ Installed glue 1.6.2 (132ms) #> ✔ Installed lifecycle 1.0.3 (149ms) #> ✔ Installed magrittr 2.0.3 (162ms) #> ✔ Installed pillar 1.8.1 (56ms) #> ✔ Installed pkgconfig 2.0.3 (35ms) #> ✔ Installed rlang 1.0.6 (57ms) #> ✔ Installed tibble 3.1.8 (41ms) #> ✔ Installed tidyselect 1.2.0 (40ms) #> ✔ Installed utf8 1.2.2 (37ms) #> ✔ Installed vctrs 0.5.1 (39ms) #> ✔ Installed withr 2.5.0 (31ms) #> ✔ 1 pkg + 15 deps: added 16 [7.2s]
Get started with pak, Package sources, FAQ, The dependency solver.
Other package functions:
lib_status()
,
pak()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_download()
,
pkg_remove()
,
pkg_status()
,
pkg_sysreqs()
Additionally, look up the candidate name in a number of dictionaries, to make sure that it does not have a negative meaning.
pkg_name_check(name, dictionaries = NULL)
pkg_name_check(name, dictionaries = NULL)
name |
Package name candidate. |
dictionaries |
Character vector, the dictionaries to query.
Available dictionaries:
* |
Check the validity of name
as a package name. See 'Writing R
Extensions' for the allowed package names. Also checked against a list
of names that are known to cause problems.
Check name
against the names of all past and current packages on
CRAN, including base and recommended packages.
Check name
against all past and current Bioconductor packages.
Check name
with https://www.purgomalum.com/service/containsprofanity
to make sure it is not a profanity.
See the dictionaries
argument.
pkg_name_check
object with a custom print method.
pkg_name_check("sicily")
#> ╔══════════════════════════════════════════════════════════════════════╗ #> ║ –*– sicily –*– ║ #> ╚══════════════════════════════════════════════════════════════════════╝ #> ┌──────────────────────────────────────────────────────────────────────┐ #> │ ✔ valid name ✔ CRAN ✔ Bioconductor │ #> │ ✔ not a profanity │ #> └──────────────────────────────────────────────────────────────────────┘ #> ┌ Wikipedia ───────────────────────────────────────────────────────────┐ #> │ Sicily Sicily (Italian: Sicilia [siˈtʃiːlja], Sicilian │ #> │ pronunciation: [sɪˈʃiːlja]) is the largest island in the │ #> │ Mediterranean Sea and one of the 20 regions of Italy. The Strait of │ #> │ Messina divides it from the region of Calabria in Southern Italy. │ #> │ It is one of the five Italian autonomous regions and is officially │ #> │ referred to as Regione Siciliana. The region has 5 million │ #> │ … │ #> └──────────────────────────────── https://en.wikipedia.org/wiki/Sicily ┘ #> ┌ Wiktionary ──────────────────────────────────────────────────────────┐ #> │ sicily No English definition found │ #> └──────────────────────────────────────────────────────────────────── ┘ #> ┌──────────────────────────────────────────────────────────────────────┐ #> │ Sentiment: 😐 (0) │ #> └──────────────────────────────────────────────────────────────────────┘
Remove installed packages
pkg_remove(pkg, lib = .libPaths()[[1L]])
pkg_remove(pkg, lib = .libPaths()[[1L]])
pkg |
A character vector of packages to remove. |
lib |
library to remove packages from. |
Nothing.
Other package functions:
lib_status()
,
pak()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_download()
,
pkg_install()
,
pkg_status()
,
pkg_sysreqs()
Search the indexed database of current CRAN packages. It uses the
pkgsearch package. See that package for more details and also
pkgsearch::pkg_search()
for pagination, more advanced searching,
etc.
pkg_search(query, ...)
pkg_search(query, ...)
query |
Search query string. |
... |
Arguments passed on to
|
A data frame, that is also a pak_search_result
object
with a custom print method. To see the underlying table, you
can use []
to drop the extra classes. See examples below.
Simple search
pkg_search("survival")
#> #> 1 survival 3.4.0 -- by Terry M Therneau, 4 months ago #> Survival Analysis #> #> 2 survminer 0.4.9 -- by Alboukadel Kassambara, 2 years ago #> Drawing Survival Curves using 'ggplot2' #> #> 3 flexsurv 2.2 -- by Christopher Jackson, 6 months ago #> Flexible Parametric Survival and Multi-State Models #> #> 4 muhaz 1.2.6.4 -- by David Winsemius, 2 years ago #> Hazard Function Estimation in Survival Analysis #> #> 5 pec 2022.5.4 -- by Thomas A. Gerds, 8 months ago #> Prediction Error Curves for Risk Prediction Models in Survival Analysi #> s #> #> 6 randomForestSRC 3.1.1 -- by Udaya B. Kogalur, 5 months ago #> Fast Unified Random Forests for Survival, Regression, and Classificati #> on (RF-SRC) #> #> 7 relsurv 2.2.8 -- by Damjan Manevski, 4 months ago #> Relative Survival #> #> 8 survRM2 1.0.4 -- by Hajime Uno, 6 months ago #> Comparing Restricted Mean Survival Time #> #> 9 titanic 0.1.0 -- by Paul Hendricks, 7 years ago #> Titanic Passenger Survival Data Set #> #> 10 KMsurv 0.1.5 -- by Jun Yan, 10 years ago #> Data sets from Klein and Moeschberger (1997), Survival Analysis
See the underlying data frame
psro <- pkg_search("ropensci") psro[]
#> # A data frame: 10 × 15 #> score package version title descr…¹ date maint…² #> <dbl> <chr> <pckg_vrs> <chr> <chr> <dttm> <chr> #> 1 538. webmockr 0.8.2 Stub… "Stubb… 2022-08-28 19:20:02 Scott … #> 2 520. RSelenium 1.7.9 R Bi… "Provi… 2022-09-02 07:10:11 Ju Yeo… #> 3 416. tracerer 2.2.2 Trac… "'BEAS… 2021-05-30 08:40:03 Richèl… #> 4 376. rfisheries 0.2 'Pro… "A pro… 2016-02-19 08:50:03 Karthi… #> 5 367. mcbette 1.15 Mode… "'BEAS… 2022-08-27 12:30:02 Richèl… #> 6 359. taxize 0.9.100 Taxo… "Inter… 2022-04-22 07:30:02 Zachar… #> 7 350. beastier 2.4.11 Call… "'BEAS… 2022-08-11 13:40:04 Richèl… #> 8 347. spocc 1.2.0 Inte… "A pro… 2021-01-05 19:50:03 Scott … #> 9 316. chromer 0.3 Inte… "A pro… 2022-10-27 22:45:36 Karl W… #> 10 315. visdat 0.5.3 Prel… "Creat… 2019-02-15 14:30:03 Nichol… #> # … with 8 more variables: maintainer_email <chr>, revdeps <int>, #> # downloads_last_month <int>, license <chr>, url <chr>, #> # bugreports <chr>, package_data <I<list>>, ago <chr>, and #> # abbreviated variable names ¹description, ²maintainer_name
Display installed locations of a package
pkg_status(pkg, lib = .libPaths())
pkg_status(pkg, lib = .libPaths())
pkg |
Name of one or more installed packages to display status for. |
lib |
One or more library paths to lookup packages status in. By default all libraries are used. |
Data frame with data about installations of pkg
.
It has always has columns:
biocviews
: the corresponding field from DESCRIPTION
, it must be
present for all Bioconductor packages, other packages typically don't
have it.
built
: the Built
field from DESCRIPTION
.
depends
, suggests
, Imports
, linkingto
, enhances
: the corresponding
fields from the DESCRIPTION
files.
deps
: A list or data frames, the dependencies of the package. It has
columns: ref
, type
(dependency type in lowercase), package
(dependent package, or R
), op
and version
, for last two are for
version requirement. op
can be >=
, >
, ==
or <=
, although the
only the first one is common in practice.
library
: path to the package library containing the package.
license
: from DESCRIPTION
.
md5sum
: from DESCTIPTION
, typically NA
, except on Windows.
needscompilation
: from DESCRIPTION
, this column is logical.
package
: package name.
platform
: from the Built
field in DESCRIPTION
, the current platform
if missing from DESCRIPTION
.
priority
: from DESCRIPTION
, usually base
, recommended
, or missing.
ref
: the corresponding installed::*
package reference.
repository
: from DESCRIPTION
. For packages from a CRAN repository this
is CRAN
, some other repositories, e.g. R-universe adds the repository
URL here.
repotype
: cran
, bioc
or missing.
rversion
: from the Built
field. If no such field, then the current
R version.
sysreqs
: the SystemRequirements
field from DESCRIPTION
.
title
: package title.
type
: always installed
.
version
: package version (as string).
Most of these columns are unchanged from DESCRIPTION
, but
pak also adds a couple.
In addition, it also has all remote*
and config/needs/*
entries from
the DESCRIPTION
files. (Case insensitive.)
All columns are of type character
, except for needscompilation
, which
is logical and deps
, which is a list columns.
If an entry is missing for a package, it is set to NA
.
Note that column names are lowercase, even if the corresponding entries
are not in DESCRIPTION
.
The order of the columns is not deterministic, so don't assume any order.
Additional columns might be present, these are internal for pak and should not be used in user code.
pkg_status("MASS")
#> # A data frame: 2 × 39 #> library package title version depends repos…¹ license needs…² built #> * <chr> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <chr> #> 1 /Users/ga… MASS Supp… 7.3-58… R (>= … CRAN GPL-2 … TRUE R 4.… #> 2 /Library/… MASS Supp… 7.3-58… R (>= … CRAN GPL-2 … TRUE R 4.… #> # … with 30 more variables: remotetype <chr>, remotepkgref <chr>, #> # remoteref <chr>, remoterepos <chr>, remotepkgplatform <chr>, #> # remotesha <chr>, imports <chr>, suggests <chr>, linkingto <chr>, #> # remotes <chr>, remotehost <chr>, remoterepo <chr>, #> # remoteusername <chr>, enhances <chr>, biocviews <chr>, #> # remoteurl <chr>, remotesubdir <chr>, priority <chr>, #> # remoteetag <chr>, remotepackaged <chr>, md5sum <chr>, …
Other package functions:
lib_status()
,
pak()
,
pkg_deps_tree()
,
pkg_deps()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_sysreqs()
Calculate system requirements of one of more packages
pkg_sysreqs(pkg, upgrade = TRUE, dependencies = NA, sysreqs_platform = NULL)
pkg_sysreqs(pkg, upgrade = TRUE, dependencies = NA, sysreqs_platform = NULL)
pkg |
Package names or package references. E.g.
See "Package sources" for more details. |
upgrade |
When When |
dependencies |
What kinds of dependencies to install. Most commonly one of the following values:
|
sysreqs_platform |
System requirements platform. If Set this option if to one of |
List with entries:
os
: character string. Operating system.
distribution
: character string. Linux distribution, NA
if the
OS is not Linux.
version
: character string. Distribution version, NA
is the OS
is not Linux.
pre_install
: character vector. Commands to run before the
installation of system packages.
install_scripts
: character vector. Commands to run to install the
system packages.
post_install
: character vector. Commands to run after the
installation of system packages.
packages
: data frame. Information about the system packages that
are needed. It has columns:
sysreq
: string, cross-platform name of the system requirement.
packages
: list column of character vectors. The names of the R
packages that have this system requirement.
pre_install
: list column of character vectors. Commands run
before the package installation for this system requirement.
system_packages
: list column of character vectors. Names of
system packages to install.
post_install
: list column of character vectors. Commands run
after the package installation for this system requirement.
Other package functions:
lib_status()
,
pak()
,
pkg_deps()
,
pkg_deps_tree()
,
pkg_download()
,
pkg_install()
,
pkg_remove()
,
pkg_status()
Other system requirements functions:
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
Does PPM build binary packages for the current platform?
ppm_has_binaries()
ppm_has_binaries()
TRUE
or FALSE
.
The 'pkgcache and Posit Package Manager on Linux' article at https://r-lib.github.io/pkgcache/.
Other PPM functions:
ppm_platforms()
,
ppm_r_versions()
,
ppm_repo_url()
,
ppm_snapshots()
system_r_platform() ppm_has_binaries()
system_r_platform() ppm_has_binaries()
List all platforms supported by Posit Package Manager (PPM)
ppm_platforms()
ppm_platforms()
Data frame with columns:
name
: platform name, this is essentially an identifier,
os
: operating system, linux
, windows
or macOS
currently,
binary_url
: the URL segment of the binary repository URL of this
platform, see ppm_snapshots()
.
distribution
: for Linux platforms the name of the distribution,
release
: for Linux platforms, the name of the release,
binaries
: whether PPM builds binaries for this platform.
The 'pkgcache and Posit Package Manager on Linux' article at https://r-lib.github.io/pkgcache/.
Other PPM functions:
ppm_has_binaries()
,
ppm_r_versions()
,
ppm_repo_url()
,
ppm_snapshots()
ppm_platforms()
ppm_platforms()
List all R versions supported by Posit Package Manager (PPM)
ppm_r_versions()
ppm_r_versions()
Data frame with columns:
r_version
: minor R versions, i.e. version numbers containing the
first two components of R versions supported by this PPM instance.
The 'pkgcache and Posit Package Manager on Linux' article at https://r-lib.github.io/pkgcache/.
Other PPM functions:
ppm_has_binaries()
,
ppm_platforms()
,
ppm_repo_url()
,
ppm_snapshots()
ppm_r_versions()
ppm_r_versions()
Returns the current Posit Package Manager (PPM) repository URL
ppm_repo_url()
ppm_repo_url()
This URL has the form {base}/{repo}
, e.g.
https://packagemanager.posit.co/all
.
To configure a hosted PPM instance, set the PKGCACHE_PPM_URL
environment variable to the base URL (e.g.
https://packagemanager.posit.co
).
To use repo_add()
with PPM snapshots, you may also set the
PKGCACHE_PPM_REPO
environment variable to the name of the default
repository.
On Linux, instead of setting these environment variables, you can also
add a PPM repository to the repos
option, see base::options()
.
In the environment variables are not set, then ppm_repo_url()
will
try extract the PPM base URL and repository name from this option.
If the PKGCACHE_PPM_URL
environment variable is not set, and the
repos
option does not contain a PPM URL (on Linux), then pak
uses the public PPM instance at https://packagemanager.posit.co
, with
the cran
repository.
String scalar, the repository URL of the configured PPM
instance. If no PPM instance is configured, then the URL of the Posit
Public Package Manager instance. It includes the repository name, e.g.
https://packagemanager.posit.co/all
.
The 'pkgcache and Posit Package Manager on Linux' article at https://r-lib.github.io/pkgcache/.
repo_resolve()
and repo_add()
to find and configure PPM
snapshots.
Other PPM functions:
ppm_has_binaries()
,
ppm_platforms()
,
ppm_r_versions()
,
ppm_snapshots()
ppm_repo_url()
ppm_repo_url()
List all available Posit Package Manager (PPM) snapshots
ppm_snapshots()
ppm_snapshots()
The repository URL of a snapshot has the following form on Windows:
{base}/{repo}/{id}
where {base}
is the base URL for PPM (see ppm_repo_url()
) and
{id}
is either the date or id of the snapshot, or latest
for
the latest snapshot. E.g. these are equivalent:
https://packagemanager.posit.co/cran/5 https://packagemanager.posit.co/cran/2017-10-10
On a Linux distribution that has PPM support, the repository URL that contains the binary packages looks like this:
{base}/{repo}/__linux__/{binary_url}/{id}
where {id}
is as before, and {binary_url}
is a code name for a release
of a supported Linux distribution. See the binary_url
column of the
result of ppm_platforms()
for these code names.
Data frame with two columns:
date
: the time the snapshot was taken, a POSIXct
vector,
id
: integer id of the snapshot, this can be used in the repository
URL.
The 'pkgcache and Posit Package Manager on Linux' article at https://r-lib.github.io/pkgcache/.
Other PPM functions:
ppm_has_binaries()
,
ppm_platforms()
,
ppm_r_versions()
,
ppm_repo_url()
ppm_snapshots()
ppm_snapshots()
Add a new repository to the list of repositories that pak uses to look for packages.
repo_add(..., .list = NULL) repo_resolve(spec)
repo_add(..., .list = NULL) repo_resolve(spec)
... |
Repository specifications, possibly named character vectors. See details below. |
.list |
List or character vector of repository specifications.
This argument is easier to use programmatically than |
spec |
Repository specification, a possibly named character scalar. |
repo_add()
adds new repositories. It resolves the specified
repositories using repo_resolve()
and then modifies the repos
global option.
repo_add()
only has an effect in the current R session. If you
want to keep your configuration between R sessions, then set the
repos
option to the desired value in your user or project .Rprofile
file.
repo_resolve()
returns a named character scalar, the URL
of the repository.
The format of a repository specification is a named or unnamed
character scalar. If the name is missing, pak adds a name
automatically. The repository named CRAN
is the main CRAN repository,
but otherwise names are informational.
Currently supported repository specifications:
URL pointing to the root of the CRAN-like repository. Example:
https://cloud.r-project.org
PPM@latest
, PPM (Posit Package Manager, formerly RStudio Package
Manager), the latest snapshot.
PPM@<date>
, PPM (Posit Package Manager, formerly RStudio Package
Manager) snapshot, at the specified date.
PPM@<package>-<version>
PPM snapshot, for the day after the
release of <version>
of <package>
.
PPM@R-<version>
PPM snapshot, for the day after R <version>
was released.
Still works for dates starting from 2017-10-10, but now deprecated, because MRAN is discontinued:
MRAN@<date>
, MRAN (Microsoft R Application Network) snapshot, at
the specified date.
MRAN@<package>-<version>
MRAN snapshot, for the
day after the release of <version>
of <package>
.
MRAN@R-<version>
MRAN snapshot, for the day
after R <version>
was released.
Notes:
See more about PPM at https://packagemanager.posit.co/client/#/.
The RSPM@
prefix is still supported and treated the same way as
PPM@
.
The MRAN service is now retired, see https://techcommunity.microsoft.com/t5/azure-sql-blog/microsoft-r-application-network-retirement/ba-p/3707161 for details.
MRAN@...
repository specifications now resolve to PPM, but note that
PPM snapshots are only available from 2017-10-10. See more about this
at https://posit.co/blog/migrating-from-mran-to-posit-package-manager/.
All dates (or times) can be specified in the ISO 8601 format.
If PPM does not have a snapshot available for a date, the next available date is used.
Dates that are before the first, or after the last PPM snapshot will trigger an error.
Unknown R or package versions will trigger an error.
repo_add(PPMdplyr100 = "[email protected]") repo_get()
#> # A data frame: 7 × 5 #> name url type r_version bioc_version #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cloud.r-project.org cran * NA #> 2 PPMdplyr100 https://packagemanager.pos… cran… * NA #> 3 BioCsoft https://bioconductor.org/p… bioc 4.3.1 3.17 #> 4 BioCann https://bioconductor.org/p… bioc 4.3.1 3.17 #> 5 BioCexp https://bioconductor.org/p… bioc 4.3.1 3.17 #> 6 BioCworkflows https://bioconductor.org/p… bioc 4.3.1 3.17 #> 7 BioCbooks https://bioconductor.org/p… bioc 4.3.1 3.17
repo_resolve("PPM@2020-01-21")
#> CRAN #> "https://packagemanager.posit.co/cran/245"
repo_resolve("[email protected]")
#> CRAN #> "https://packagemanager.posit.co/cran/289"
repo_resolve("[email protected]")
#> CRAN #> "https://packagemanager.posit.co/cran/276"
Other repository functions:
repo_get()
,
repo_status()
pak uses the repos
option, see options()
. It also automatically
adds a CRAN mirror if none is set up, and the correct version of the
Bioconductor repositories. See the cran_mirror
and bioc
arguments.
repo_get(r_version = getRversion(), bioc = NULL, cran_mirror = NULL)
repo_get(r_version = getRversion(), bioc = NULL, cran_mirror = NULL)
r_version |
R version to use to determine the correct Bioconductor
version, if |
bioc |
Whether to automatically add the Bioconductor repositories to the result. |
cran_mirror |
CRAN mirror to use. Leave it at |
repo_get()
returns the table of the currently configured repositories.
repo_get()
#> # A data frame: 5 × 5 #> name url type r_ver…¹ bioc_…² #> * <chr> <chr> <chr> <chr> <chr> #> 1 CRAN https://cloud.r-project.org cran * NA #> 2 BioCsoft https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 3 BioCann https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 4 BioCexp https://bioconductor.org/packages… bioc 4.2.2 3.16 #> 5 BioCworkflows https://bioconductor.org/packages… bioc 4.2.2 3.16 #> # … with abbreviated variable names ¹r_version, ²bioc_version
Other repository functions:
repo_add()
,
repo_status()
It checks the status of the configured or supplied repositories.
repo_status( platforms = NULL, r_version = getRversion(), bioc = NULL, cran_mirror = NULL ) repo_ping( platforms = NULL, r_version = getRversion(), bioc = NULL, cran_mirror = NULL )
repo_status( platforms = NULL, r_version = getRversion(), bioc = NULL, cran_mirror = NULL ) repo_ping( platforms = NULL, r_version = getRversion(), bioc = NULL, cran_mirror = NULL )
platforms |
Platforms to use, default is the current platform,
plus source packages, via the |
r_version |
R version(s) to use, the default is the current
R version, via |
bioc |
Whether to add the Bioconductor repositories. If you
already configured them via |
cran_mirror |
The CRAN mirror to use. Defaults to the
|
repo_ping()
is similar to repo_status()
but also prints a short
summary of the data, and it returns its result invisibly.
A data frame that has a row for every repository, on every queried platform and R version. It has these columns:
name
: the name of the repository. This comes from the names
of the configured repositories in options("repos")
, or
added by pak. It is typically CRAN
for CRAN, and the
current Bioconductor repositories are BioCsoft
, BioCann
,
BioCexp
, BioCworkflows
.
url
: base URL of the repository.
bioc_version
: Bioconductor version, or NA
for
non-Bioconductor repositories.
platform
: platform, possible values are source
, macos
and
windows
currently.
path
: the path to the packages within the base URL, for a
given platform and R version.
r_version
: R version, one of the specified R versions.
ok
: Logical flag, whether the repository contains a metadata
file for the given platform and R version.
ping
: HTTP response time of the repository in seconds. If
the ok
column is FALSE
, then this columns in NA
.
error
: the error object if the HTTP query failed for this
repository, platform and R version.
repo_status()
#> # A data frame: 10 × 10 #> name url type bioc_…¹ platf…² path r_ver…³ ok ping error #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <dbl> <list> #> 1 CRAN http… cran NA source src/… 4.2 TRUE 0.269 <NULL> #> 2 CRAN http… cran NA aarch6… bin/… 4.2 TRUE 0.265 <NULL> #> 3 BioCsoft http… bioc 3.16 source src/… 4.2 TRUE 0.264 <NULL> #> 4 BioCsoft http… bioc 3.16 aarch6… bin/… 4.2 TRUE 0.271 <NULL> #> 5 BioCann http… bioc 3.16 source src/… 4.2 TRUE 0.383 <NULL> #> 6 BioCann http… bioc 3.16 aarch6… bin/… 4.2 TRUE 0.392 <NULL> #> 7 BioCexp http… bioc 3.16 source src/… 4.2 TRUE 0.507 <NULL> #> 8 BioCexp http… bioc 3.16 aarch6… bin/… 4.2 TRUE 0.739 <NULL> #> 9 BioCwor… http… bioc 3.16 source src/… 4.2 TRUE 0.505 <NULL> #> 10 BioCwor… http… bioc 3.16 aarch6… bin/… 4.2 TRUE 0.766 <NULL> #> # … with abbreviated variable names ¹bioc_version, ²platform, #> # ³r_version
repo_status( platforms = c("windows", "macos"), r_version = c("4.0", "4.1") )
#> # A data frame: 15 × 10 #> name url type bioc_…¹ platf…² r_ver…³ path ok ping #> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <lgl> <dbl> #> 1 CRAN https… cran NA i386+x… 4.0 bin/… TRUE 0.198 #> 2 CRAN https… cran NA i386+x… 4.1 bin/… TRUE 0.197 #> 3 CRAN https… cran NA aarch6… 4.1 bin/… TRUE 0.197 #> 4 BioCsoft https… bioc 3.12 i386+x… 4.0 bin/… TRUE 0.988 #> 5 BioCann https… bioc 3.12 i386+x… 4.0 bin/… TRUE 1.03 #> 6 BioCexp https… bioc 3.12 i386+x… 4.0 bin/… TRUE 1.25 #> 7 BioCworkflows https… bioc 3.12 i386+x… 4.0 bin/… TRUE 1.47 #> 8 BioCsoft https… bioc 3.14 i386+x… 4.1 bin/… TRUE 1.48 #> 9 BioCsoft https… bioc 3.14 aarch6… 4.1 bin/… FALSE NA #> 10 BioCann https… bioc 3.14 i386+x… 4.1 bin/… TRUE 1.45 #> 11 BioCann https… bioc 3.14 aarch6… 4.1 bin/… FALSE NA #> 12 BioCexp https… bioc 3.14 i386+x… 4.1 bin/… TRUE 1.72 #> 13 BioCexp https… bioc 3.14 aarch6… 4.1 bin/… FALSE NA #> 14 BioCworkflows https… bioc 3.14 i386+x… 4.1 bin/… TRUE 1.71 #> 15 BioCworkflows https… bioc 3.14 aarch6… 4.1 bin/… FALSE NA #> # … with 1 more variable: error <list>, and abbreviated variable names #> # ¹bioc_version, ²platform, ³r_version
repo_ping()
#> Repository summary: source aarch64-apple-darwin20 #> CRAN @ cloud.r-project.org ✔ ✔ (194ms) #> BioCsoft @ bioconductor.org ✔ ✔ (352ms) #> BioCann @ bioconductor.org ✔ ✔ (511ms) #> BioCexp @ bioconductor.org ✔ ✔ (675ms) #> BioCworkflows @ bioconductor.org ✔ ✔ (698ms)
Other repository functions:
repo_add()
,
repo_get()
sysreqs_check_installed()
checks if the system requirements of all
packages (or a subset of packages) are installed.
sysreqs_fix_installed()
installs the missing system packages.
sysreqs_check_installed(packages = NULL, library = .libPaths()[1]) sysreqs_fix_installed(packages = NULL, library = .libPaths()[1])
sysreqs_check_installed(packages = NULL, library = .libPaths()[1]) sysreqs_fix_installed(packages = NULL, library = .libPaths()[1])
packages |
If not |
library |
Library or libraries to check. |
These functions use the sysreqs_platform
configuration option,
see Configuration. Set this if
pak does not detect your platform correctly.
Data frame with a custom print and format method, and a
pkg_sysreqs_check_result
class. Its columns are:
system_package
: string, name of the required system package.
installed
: logical, whether the system package is correctly
installed.
packages
: list column of character vectors. The names of the
installed R packages that need this system package.
pre_install
: list column of character vectors. Commands to run
before the installation of the the system package.
post_install
: list column of character vectors. Commands to run
after the installation of the system package.
The data frame also have two attributes with additional data:
sysreqs_records
: the raw system requirements records, and
system_packages
: the list of the installed system packages.
sysreqs_fix_packages()
returns the same value, but invisibly.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
# This only works on supported platforms sysreqs_check_installed()
# This only works on supported platforms sysreqs_check_installed()
It also tries to update the system dependency database, if it is
outdated. (I.e. older than allowed in the metadata_update_after
configuration option.
sysreqs_db_list(sysreqs_platform = NULL)
sysreqs_db_list(sysreqs_platform = NULL)
sysreqs_platform |
System requirements platform. If |
Data frame with columns:
name
: cross platform system dependency name in the database.
patterns
: one or more regular expressions to match to
SystemRequirements
fields.
packages
: one or more system package names to install.
pre_install
: command(s) to run before installing the packages.
post_install
:: command(s) to run after installing the packages.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
sysreqs_db_list(sysreqs_platform = "ubuntu-22.04")
sysreqs_db_list(sysreqs_platform = "ubuntu-22.04")
In the usual workflow pak matches the
SystemRequirements
fields of the DESCRIPTION
files to the database.
sysreqs_db_match(specs, sysreqs_platform = NULL)
sysreqs_db_match(specs, sysreqs_platform = NULL)
specs |
Character vector of system requirements descriptions. |
sysreqs_platform |
System requirements platform. If |
The sysreqs_db_match()
function lets you match any string, and it is
mainly useful for debugging.
Data frame with columns:
spec
: the input specs
.
sysreq
: name of the system library or tool.
packages
: system packages, list column of character vectors.
Rarely it can be an empty string, e.g. if a pre_install
script
performs the installation.
pre_install
: list column of character vectors. Shell script(s) to
run before the installation.
post_install
: list column of character vectors. Shell script(s) to
run after the installation.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
sysreqs_db_match( c("Needs libcurl", "Java, libssl"), sysreqs_platform = "ubuntu-22.04" )
sysreqs_db_match( c("Needs libcurl", "Java, libssl"), sysreqs_platform = "ubuntu-22.04" )
Update the cached copy of the system requirements database
sysreqs_db_update()
sysreqs_db_update()
If the the cached copy is recent, then no update is attempted. See the
metadata_update_after
configuration option.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
Check if a platform has system requirements support
sysreqs_is_supported(sysreqs_platform = NULL)
sysreqs_is_supported(sysreqs_platform = NULL)
sysreqs_platform |
System requirements platform. If |
Logical scalar.
The sysreqs_platform
configuration option.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_list_system_packages()
,
sysreqs_platforms()
sysreqs_is_supported()
sysreqs_is_supported()
List installed system packages
sysreqs_list_system_packages()
sysreqs_list_system_packages()
This function uses the sysreqs_platform
configuration option,
see Configuration. Set this if
pak does not detect your platform correctly.
Data frame with columns:
status
. two or three characters, the notation of dpkg
on Debian
based systems. "ii"
means the package is correctly installed.
On RPM
based systems it is always "ii"
currently.
package
: name of the system package.
version
: installed version of the system package.
capabilities
: list column of character vectors, the capabilities
provided by the package.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_platforms()
sysreqs_list_system_packages()[1:10,]
sysreqs_list_system_packages()[1:10,]
List platforms with system requirements support
sysreqs_platforms()
sysreqs_platforms()
Data frame with columns:
name
: human readable OS name.
os
: OS name, e.g. linux
.
distribution
: OS id, e.g. ubuntu
or redhat
.
version
: distribution version. A star means that all versions are
supported, that are also supported by the vendor.
update_command
: command to run to update the system package metadata.
install_command
: command to run to install packages.
query_command
: name of the tool to use to query system package
information.
Other system requirements functions:
pkg_sysreqs()
,
sysreqs_check_installed()
,
sysreqs_db_list()
,
sysreqs_db_match()
,
sysreqs_db_update()
,
sysreqs_is_supported()
,
sysreqs_list_system_packages()
sysreqs_platforms()
sysreqs_platforms()
pak takes care of your system requirements.
Many R packages need external software to be present on the machine,
otherwise they do not work, or not even load. For example the RPostgres
R package uses the PostgreSQL client library, and by default dynamically
links to it on Linux systems. This means that you (or the administrators
of your system) need to install this library, typically in the form of a
system package: libpq-dev
on Ubuntu and Debian systems, or
postgresql-server-devel
or postgresql-devel
on RedHat, Fedora, etc.
systems.
The good news is that pak helps you with this: - it looks up the
required system packages when installing R packages, - it checks if the
required system packages are installed, and - it installs them
automatically, if you are a superuser, or you can use password-less
sudo
to start a superuser shell.
In addition, pak also has some functions to query system requirements and system packages.
Call pak::sysreqs_platforms()
to list all platforms that support
system requirements:
pak::sysreqs_platforms()
## # A data frame: 10 × 7 ## name os distribution version update_command install_command ## <chr> <chr> <chr> <chr> <chr> <chr> ## 1 Ubuntu Lin… linux ubuntu * apt-get -y up… apt-get -y ins… ## 2 Debian Lin… linux debian * apt-get -y up… apt-get -y ins… ## 3 CentOS Lin… linux centos * NA yum install -y ## 4 Rocky Linux linux rockylinux * NA dnf install -y ## 5 Red Hat En… linux redhat 6 NA yum install -y ## 6 Red Hat En… linux redhat 7 NA yum install -y ## 7 Red Hat En… linux redhat * NA dnf install -y ## 8 Fedora Lin… linux fedora * NA dnf install -y ## 9 openSUSE L… linux opensuse * NA zypper --non-i… ## 10 SUSE Linux… linux sle * NA zypper --non-i… ## # ℹ 1 more variable: query_command <chr>
Call pak::sysreqs_is_supported()
to see if your system is supported:
pak::sysreqs_is_supported()
## [1] TRUE
This vignette was built on Ubuntu 22.04.2 LTS, which is a platform pak does support. So in the following you will see the output of the code.
If you are using pak as a superuser, on a supported platform, then pak will look up system requirements, and install the missing ones. Here is an example:
pak::pkg_install("RPostgres")
## ✔ Loading metadata database ... done ## ## → Will install 17 packages. ## → All 17 packages (0 B) are cached. ## + DBI 1.1.3 ## + RPostgres 1.4.5 + ✖ libpq-dev ## + Rcpp 1.0.10 ## + bit 4.0.5 ## + bit64 4.0.5 ## + blob 1.2.4 ## + cli 3.6.1 ## + generics 0.1.3 ## + glue 1.6.2 ## + hms 1.1.3 ## + lifecycle 1.0.3 ## + lubridate 1.9.2 ## + pkgconfig 2.0.3 ## + rlang 1.1.1 ## + timechange 0.2.0 ## + vctrs 0.6.2 ## + withr 2.5.0 ## → Will install 1 system package: ## + libpq-dev - RPostgres ## ℹ No downloads are needed, 17 pkgs are cached ## ℹ Installing system requirements ## ℹ Executing `sh -c apt-get -y update` ## ℹ Executing `sh -c apt-get -y install libpq-dev` ## ✔ Installed DBI 1.1.3 (1.1s) ## ✔ Installed RPostgres 1.4.5 (1.2s) ## ✔ Installed Rcpp 1.0.10 (1.2s) ## ✔ Installed bit 4.0.5 (1.2s) ## ✔ Installed bit64 4.0.5 (148ms) ## ✔ Installed blob 1.2.4 (63ms) ## ✔ Installed cli 3.6.1 (88ms) ## ✔ Installed generics 0.1.3 (61ms) ## ✔ Installed glue 1.6.2 (63ms) ## ✔ Installed hms 1.1.3 (62ms) ## ✔ Installed lifecycle 1.0.3 (61ms) ## ✔ Installed lubridate 1.9.2 (87ms) ## ✔ Installed pkgconfig 2.0.3 (62ms) ## ✔ Installed rlang 1.1.1 (1.1s) ## ✔ Installed timechange 0.2.0 (1.1s) ## ✔ Installed vctrs 0.6.2 (1.1s) ## ✔ Installed withr 2.5.0 (1.1s) ## ✔ 1 pkg + 16 deps: added 17 [17.5s]
If you don’t want to use R as the superuser, but you can set up sudo
without a password, that works as well. pak will automatically detect
the password-less sudo
capability, and use it to install system
packages, as needed.
If you run R as a regular (not root) user, and password-less sudo
is
not available, then pak will print the system requirements, but it will
not try to install or update them. If you are installing source packages
that need to link to system libraries, then their installation will
probably fail, until you install these system packages. If you are
installing binary R packages, then the installation typically succeeds,
but you won’t be able to load these packages into R, until you install
the required system packages. Here is an example, on a system that does
not have the required system package installed for RPostgres. If you are
installing a source R package, the installation already fails:
pak::pkg_install("RPostgres?source")
## + plogr 0.2.0 ## ✖ Missing 1 system package. You'll probably need to install it ## manually: ## + libpq-dev - RPostgres ## ℹ No downloads are needed, 2 pkgs (1.47 MB) are cached ## ✔ Installed plogr 0.2.0 (1.1s) ## ℹ Building RPostgres 1.4.5 ## ✖ Failed to build RPostgres 1.4.5 ## Registered S3 methods overwritten by 'callr': ## method from ## format.callr_status_error ## print.callr_status_error ## Error: ## ! error in pak subprocess ## Caused by error in `stop_task_build(state, worker)`: ## ! Failed to build source package 'RPostgres' ## Full installation output: ## * installing *source* package ‘RPostgres’ ... ## ** package ‘RPostgres’ successfully unpacked and MD5 sums checked ## staged installation is only possible with locking ## ** using non-staged installation ## Using PKG_CFLAGS= ## Using PKG_LIBS=-lpq ## Using PKG_PLOGR= ## ------------------------- ANTICONF ERROR --------------------------- ## Configuration failed because libpq was not found. Try installing: ## * deb: libpq-dev libssl-dev (Debian, Ubuntu, etc) ## * rpm: postgresql-devel (Fedora, EPEL) ## * rpm: postgreql8-devel, psstgresql92-devel, postgresql93-devel, or pos ## tgresql94-devel (Amazon Linux) ## * csw: postgresql_dev (Solaris) ## * brew: libpq (OSX) ## If libpq is already installed, check that either: ## (i) 'pkg-config' is in your PATH AND PKG_CONFIG_PATH contains ## a libpq.pc file; or ## (ii) 'pg_config' is in your PATH. ## If neither can detect , you can set INCLUDE_DIR ## and LIB_DIR manually via: ## R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...' ## --------------------------[ ERROR MESSAGE ]---------------------------- ## <stdin>:1:10: fatal error: libpq-fe.h: No such file or directory ## compilation terminated. ## ----------------------------------------------------------------------- ## ERROR: configuration failed for package ‘RPostgres’ ## * removing ‘/tmp/RtmpsOXbPZ/pkg-lib4a492949a49e/RPostgres’ ## --- ## Backtrace: ## 1. pak::pkg_install("RPostgres?source") ## 2. pak:::remote(function(...) get("pkg_install_do_plan", asNamespace("pa ## k")… at package.R:84:3 ## 3. err$throw(res$error) at subprocess.R:115:5 ## --- ## Subprocess backtrace: ## 1. base::withCallingHandlers(cli_message = function(msg) { … ## 2. get("pkg_install_do_plan", asNamespace("pak"))(...) ## 3. proposal$install() ## 4. pkgdepends::install_package_plan(plan, lib = private$library, num_wo ## rkers = nw… ## 5. base::withCallingHandlers({ … ## 6. pkgdepends:::handle_events(state, events) ## 7. pkgdepends:::handle_event(state, i) ## 8. pkgdepends:::stop_task(state, worker) ## 9. pkgdepends:::stop_task_build(state, worker) ## 10. base::throw(new_pkg_build_error("Failed to build source package {pkg ## }", … ## 11. | base::signalCondition(cond) ## 12. global (function (e) … ## Execution halted
On the other hand, if you are installing binary packages, e.g. from the Posit Package Manager, then the installation typically succeeds, but then loading the package fails:
pak::pkg_install("RPostgres") library(RPostgres)
## → Will install 17 packages. ## → All 17 packages (0 B) are cached. ## + DBI 1.1.3 ## + RPostgres 1.4.5 + ✖ libpq-dev ## + Rcpp 1.0.10 ## + bit 4.0.5 ## + bit64 4.0.5 ## + blob 1.2.4 ## + cli 3.6.1 ## + generics 0.1.3 ## + glue 1.6.2 ## + hms 1.1.3 ## + lifecycle 1.0.3 ## + lubridate 1.9.2 ## + pkgconfig 2.0.3 ## + rlang 1.1.1 ## + timechange 0.2.0 ## + vctrs 0.6.2 ## + withr 2.5.0 ## ✖ Missing 1 system package. You'll probably need to install it ## manually: ## + libpq-dev - RPostgres ## ℹ No downloads are needed, 17 pkgs are cached ## ✔ Installed DBI 1.1.3 (1.1s) ## ✔ Installed RPostgres 1.4.5 (1.1s) ## ✔ Installed Rcpp 1.0.10 (1.2s) ## ✔ Installed bit 4.0.5 (1.2s) ## ✔ Installed bit64 4.0.5 (144ms) ## ✔ Installed blob 1.2.4 (1.1s) ## ✔ Installed cli 3.6.1 (1.1s) ## ✔ Installed generics 0.1.3 (90ms) ## ✔ Installed glue 1.6.2 (87ms) ## ✔ Installed hms 1.1.3 (1.1s) ## ✔ Installed lifecycle 1.0.3 (1.1s) ## ✔ Installed lubridate 1.9.2 (1.1s) ## ✔ Installed pkgconfig 2.0.3 (1.1s) ## ✔ Installed rlang 1.1.1 (1.1s) ## ✔ Installed timechange 0.2.0 (1.1s) ## ✔ Installed vctrs 0.6.2 (1.1s) ## ✔ Installed withr 2.5.0 (1.1s) ## ✔ 1 pkg + 16 deps: added 17 [11.6s] ## Error: package or namespace load failed for ‘RPostgres’ in dyn.load(file ## , DLLpath = DLLpath, ...): ## unable to load shared object '/tmp/RtmpWqZycA/lib/RPostgres/libs/RPostg ## res.so': ## libpq.so.5: cannot open shared object file: No such file or directory ## Execution halted
If you only want to query system requirements, without installing any
packages, use the pkg_sysreqs()
function. This is similar to
pkg_deps()
but in addition to looking up package dependencies, it also
looks up system dependencies, and only reports the latter:
pak::pkg_sysreqs(c("curl", "xml2", "devtools", "CHRONOS"))
## ✔ Loading metadata database ... done
## ── Install scripts ───────────────────────────────────── Ubuntu 22.04 ──
## apt-get -y update
## apt-get -y install libcurl4-openssl-dev libssl-dev libxml2-dev git make
## libgit2-dev zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev
## libtiff-dev libicu-dev libfontconfig1-dev libfribidi-dev
## libharfbuzz-dev libglpk-dev libgmp3-dev default-jdk
## R CMD javareconf
## R CMD javareconf
##
## ── Packages and their system dependencies ──────────────────────────────
## CHRONOS – default-jdk, pandoc
## credentials – git
## curl – libcurl4-openssl-dev, libssl-dev
## fs – make
## gert – libgit2-dev
## gitcreds – git
## httpuv – make, zlib1g-dev
## igraph – libglpk-dev, libgmp3-dev, libxml2-dev
## knitr – pandoc
## openssl – libssl-dev
## pkgdown – pandoc
## png – libpng-dev
## ragg – libfreetype6-dev, libjpeg-dev, libpng-dev, libtiff-dev
## RCurl – libcurl4-openssl-dev, make
## remotes – git
## rJava – default-jdk, make
## rmarkdown – pandoc
## sass – make
## stringi – libicu-dev
## systemfonts – libfontconfig1-dev, libfreetype6-dev
## textshaping – libfreetype6-dev, libfribidi-dev, libharfbuzz-dev
## XML – libxml2-dev
## xml2 – libxml2-dev
See the manual of pkg_sysreqs()
to see how to programmatically extract
information from its return value.
In addition to the automatic system package lookup and installation, pak
also has some other functions to help you with system dependencies. The
sysreqs_db_list()
function lists all system requirements pak knows
about.
pak::sysreqs_db_list()
## # A data frame: 106 × 5 ## name patterns packages pre_install post_install ## <chr> <list> <list> <list> <list> ## 1 QuantLib <chr [1]> <chr [1]> <NULL> <NULL> ## 2 apparmor <chr [2]> <chr [1]> <NULL> <NULL> ## 3 atk <chr [1]> <chr [1]> <NULL> <NULL> ## 4 automake <chr [1]> <chr [1]> <NULL> <NULL> ## 5 berkeleydb <chr [2]> <chr [1]> <NULL> <NULL> ## 6 blender <chr [1]> <chr [1]> <NULL> <NULL> ## 7 bowtie2 <chr [1]> <chr [1]> <NULL> <NULL> ## 8 bwidget <chr [1]> <chr [1]> <NULL> <NULL> ## 9 cairo <chr [1]> <chr [1]> <NULL> <NULL> ## 10 chrome <chr [1]> <NULL> <chr [3]> <chr [1]> ## # ℹ 96 more rows
sysreqs_db_match()
manually matches SystemRequirements
fields
againts these system requirements:
sq <- pak::sysreqs_db_match("Needs libcurl and also Java.") sq
## [[1]] ## # A data frame: 2 × 5 ## spec sysreq packages pre_install post_install ## <chr> <chr> <list> <list> <list> ## 1 Needs libcurl and also Java. java <chr> <NULL> <chr [1]> ## 2 Needs libcurl and also Java. libcurl <chr> <NULL> <NULL> ##
sq[[1]]$packages
## [[1]] ## [1] "default-jdk" ## ## [[2]] ## [1] "libcurl4-openssl-dev" ##
You can also use it to query system requirements for other platfosm:
sqrhel9 <- pak::sysreqs_db_match("Needs libcurl and also Java.", "redhat-9") sqrhel9
## [[1]] ## # A data frame: 2 × 5 ## spec sysreq packages pre_install post_install ## <chr> <chr> <list> <list> <list> ## 1 Needs libcurl and also Java. java <chr> <NULL> <chr [1]> ## 2 Needs libcurl and also Java. libcurl <chr> <NULL> <NULL> ##
sqrhel9[[1]]$packages
## [[1]] ## [1] "java-11-openjdk-devel" ## ## [[2]] ## [1] "libcurl-devel" ##
sysreqs_list_system_packages()
is a cross-platform way of listing all
installed system packages and capabilities:
pak::sysreqs_list_system_packages()
## # A data frame: 433 × 4 ## status package version provides ## <chr> <chr> <chr> <list> ## 1 ii adduser 3.118ubuntu5 <chr [0]> ## 2 ii apt 2.4.8 <chr [1]> ## 3 ii autoconf 2.71-2 <chr [0]> ## 4 ii automake 1:1.16.5-1.3 <chr [2]> ## 5 ii autotools-dev 20220109.1 <chr [0]> ## 6 ii base-files 12ubuntu4.3 <chr [1]> ## 7 ii base-passwd 3.5.52build1 <chr [0]> ## 8 ii bash 5.1-6ubuntu1 <chr [0]> ## 9 ii binutils 2.38-4ubuntu2.1 <chr [2]> ## 10 ii binutils-common 2.38-4ubuntu2.1 <chr [0]> ## # ℹ 423 more rows
sysreqs_check_installed()
is a handy function that checks if all
system requirements are installed for some or all R packages that are
installed in your library:
pak::sysreqs_check_installed()
## system package installed required by ## -------------- -- ----------- ## git ✔ gitcreds ## gsfonts ✔ magick ## imagemagick ✔ magick ## libarchive-dev ✔ archive ## libcurl4-openssl-dev ✔ curl ## libfontconfig1-dev ✔ systemfonts ## libfreetype6-dev ✔ ragg, systemfonts, textshaping ## libfribidi-dev ✔ textshaping ## libharfbuzz-dev ✔ textshaping ## libicu-dev ✔ stringi ## libjpeg-dev ✔ ragg ## libmagick++-dev ✔ magick ## libnode-dev ✔ V8 ## libpng-dev ✔ ragg ## libpq-dev ✖ RPostgres ## libssl-dev ✔ curl, openssl ## libtiff-dev ✔ ragg ## libxml2-dev ✔ xml2 ## make ✔ fs, sass ## pandoc ✔ knitr, rmarkdown ## zlib1g-dev ✔ data.table
sysreqs_fix_installed()
goes one step further and also tries to
install the missing system requirements.
The system requirements database that pak uses does not currently differentiate between build-time and run-time dependencies. A build-time dependency is a system package that you need when installing an R package from source. A run-time dependency is a system package that you need when using an R package. Most Linux distribution create (at least) two packages for each software library: a runtime package and a development package. For an R package that uses such a software library, the runtime package is a run-time dependency and the development package is a build-time dependency. However, pak does not currently know the difference between build-time and run-time dependencies, and it will install both types of dependencies, always. This means that pak usually installs system packages that are not strictly necessary. These are typically development packages of libraries, i.e. header files, and typically do not cause any issues. If you are short on disk space, then you can try removing them.
pak uses the database of system requirements at
https://github.com/rstudio/r-system-requirements. It has its own copy
of the database embedded into the package, and it also tries to download
updated versions of the database from GitHub, if its current copy is
older than one day. You can explicitly update the database from GitHub
using the sysreqs_db_update()
function.
For CRAN packages, it downloads the SystemRequirements
fields from
https://cran.r-pkg.org/metadata
, which is a database updated daily.
For Bioconductor packages, it downloads then from GitHub. (We are
planning on moving CRAN database to GitHub as well.)
For packages sources that require pak to obtain a package DESCRIPTION
file (e.g. github::
, git::
, etc.), pak obtains SystemRequirements
directly from the DESCRIPTION
file.
Once having the SystemRequirements
fields, pak matches them to the
database, to obtain the cacnonized list of system requirements.
Then pak queries the local platform, to see the exact system packages needed. It also queries the installed system packages, to avoid trying to install system packages that are already installed.
There are several pak configuration options you can use to adjust how
system requirements are handled. We will list some of them here, please
see the options with a sysreqs
prefix in the ?pak-config
manual page
for a complete and current list.
sysreqs
: whether to install system requirements. The default is
TRUE
if the platform is supported and the user can install system
packages, either because it is the superuser, or via sudo
. If it
is FALSE
(or the user cannot install system packages), but the
platform is supported, system requirements are printed, but not
installed.
sysreqs_db_update
: whether to try to update the system
requirements database from GitHub.
sysreqs_db_update_timeout
: timeout for the system requirements
update from GitHub.
sysreqs_dry_run
: if TRUE
then pak only prints the install
commands, but does not actually run them.
sysreqs_platform
: the platform name to use for determining system
requirements. Defaults to the current platform. If you are using a
Linux distribution that is compatible with some distribution that
pak supports, then you can set this option manually. E.g.
Ubuntu-based distros can set it to ubuntu-22.04
, or the
appropriate Ubuntu version.
sysreqs_sudo
: whether to use sudo
to install system packages. If
this is not set, then pak tries to auto-detect if sudo
is needed
or not.
sysreqs_update
: whether to try to update system packages that are
already installed. pak does not know which version of a system
package is required, and it does not try to update system packages
by default. If you think that you need newer system packages, then
you can set this option to TRUE
.
sysreqs_verbose
: whether to print the output of the system package
installation commands. Useful for debugging, and it is TRUE
by
default in a CI environment.
While the system requirements database has some information about system dependencies on Windows, pak does not use this information and it does not try to install system software on Windows. CRAN, PPM and Bioconductor have Windows binary packages available for the majority of R packages they serve, and these packages practically always link to system libraries statically, so they don’t need any external software.
If you wish to compile Windows packages from source, then you need to
install the appropriate version of Rtools, and possibly extra packages
using the pacman
tool of Rtools4x.
Rtools42 and newer Rtools versions bundle lots of libraries, so most
likely no extra pacman
packages are needed. Rtools40 has a leaner
default installation, and you’ll probably need to install packages
manually:
https://github.com/r-windows/docs/blob/master/rtools40.md#readme
We are planning on adding better Windows system software support to pak in the future.
pak does not currently have system requirement information for macOS. macOS is similar to Windows, in that most repositories will serve statically linked macOS binary packages that do not need system software.
If you do need to compile packages from source, then you possibly need to install some sytem libraries, either via Homebrew, or by downloading CRAN’s static library builds from https://mac.r-project.org/bin/
We are planning on adding better macOS system software support to pak in the future.
R platforms
system_r_platform() system_r_platform_data()
system_r_platform() system_r_platform_data()
system_r_platform()
detects the platform of the current R version.
system_r_platform_data()
is similar, but returns the raw data instead
of a character scalar.
By default pak works with source packages and binary packages for
the current platform. You can change this, by providing different
platform names in the pkg.platforms
option or the
PKG_PLATFORMS
environment variable.
This option may contain the following platform names:
"source"
for source packages,
"macos"
for macOS binaries that are appropriate for the R versions
pak is working with. Packages for incompatible CPU architectures are
dropped (defaulting to the CPU of the current macOS machine and x86_64 on
non-macOS systems). The macOS Darwin version is selected based on the
CRAN macOS binaries. E.g. on R 3.5.0 macOS binaries
are built for macOS El Capitan.
"windows"
for Windows binaries for the default CRAN architecture.
This is currently Windows Vista for all supported R versions, but it
might change in the future. The actual binary packages in the
repository might support both 32 bit and 64 builds, or only one of
them. In practice 32-bit only packages are very rare. CRAN builds
before and including R 4.1 have both architectures, from R 4.2 they
are 64 bit only. "windows"
is an alias to i386+x86_64-w64-mingw32
currently.
A platform string like R.version$platform
, but on Linux the name
and version of the distribution are also included. Examples:
x86_64-apple-darwin17.0
: macOS High Sierra.
aarch64-apple-darwin20
: macOS Big Sur on arm64.
x86_64-w64-mingw32
: 64 bit Windows.
i386-w64-mingw32
: 32 bit Windows.
i386+x86_64-w64-mingw32
: 64 bit + 32 bit Windows.
i386-pc-solaris2.10
: 32 bit Solaris. (Some broken 64 Solaris
builds might have the same platform string, unfortunately.)
x86_64-pc-linux-gnu-debian-10
: Debian Linux 10 on x86_64.
x86_64-pc-linux-musl-alpine-3.14.1
: Alpine Linux.
x86_64-pc-linux-gnu-unknown
: Unknown Linux Distribution on x86_64.
s390x-ibm-linux-gnu-ubuntu-20.04
: Ubuntu Linux 20.04 on S390x.
amd64-portbld-freebsd12.1
: FreeBSD 12.1 on x86_64.
system_r_platform()
returns a character scalar.
system_r_platform_data()
returns a data frame with character
scalar columns:
cpu
,
vendor
,
os
,
distribution
(only on Linux),
release
(only on Linux),
platform
: the concatenation of the other columns, separated by
a dash.
These function call pkgcache::current_r_platform()
and
pkgcache::current_r_platform_data()
.
system_r_platform() system_r_platform_data()
system_r_platform() system_r_platform_data()
pak contains a package dependency solver, that makes sure that the package source and version requirements of all packages are satisfied, before starting an installation. For CRAN and BioC packages this is usually automatic, because these repositories are generally in a consistent state. If packages depend on other other package sources, however, this is not the case.
Here is an example of a conflict detected:
> pak::pkg_install(c("r-lib/pkgcache@conflict", "r-lib/cli@message")) Error: Cannot install packages: * Cannot install `r-lib/pkgcache@conflict`. - Cannot install dependency r-lib/cli@main * Cannot install `r-lib/cli@main`. - Conflicts r-lib/cli@message
r-lib/pkgcache@conflict
depends on the main branch of r-lib/cli
,
whereas, we explicitly requested the message
branch. Since it cannot
install both versions into a single library, pak quits.
When pak considers a package for installation, and the package is given with its name only, (e.g. as a dependency of another package), then the package may have any package source. This is necessary, because one R package library may contain only at most one version of a package with a given name.
pak's behavior is best explained via an example.
Assume that you are installing a local package (see below), e.g.
local::.
, and the local package depends on pkgA
and user/pkgB
,
the latter being a package from GitHub (see below), and that pkgA
also depends on pkgB
. Now pak must install pkgB
and user/pkgB
.
In this case pak interprets pkgB
as a package from any package source,
instead of a standard package, so installing user/pkgB
satisfies both
requirements.
Note that that cran::pkgB
and user/pkgB
requirements result a
conflict that pak cannot resolve. This is because the first one must
be a CRAN package, and the second one must be a GitHub package, and
two different packages with the same cannot be installed into an R
package library.