r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
646 stars 57 forks source link

'invalid argument type' error in 'version_satisfies' #476

Closed kevinushey closed 1 year ago

kevinushey commented 1 year ago

To reproduce (apologies, it's not quite minimal...) Note that these remotes were derived from an renv lockfile.

remotes <- c(
  'BiocManager@1.30.20',
  'Matrix@1.5-3',
  'R6@2.5.1',
  'Rcpp@1.0.10',
  'RcppTOML@0.2.2',
  'askpass@1.1',
  'base64enc@0.1-3',
  'brew@1.0-8',
  'brio@1.1.3',
  'bslib@0.4.2',
  'cachem@1.0.7',
  'callr@3.7.3',
  'cli@3.6.1',
  'clipr@0.8.0',
  'commonmark@1.9.0',
  'covr@3.6.2',
  'cpp11@0.4.3',
  'crayon@1.5.2',
  'credentials@1.3.2',
  'curl@5.0.0',
  'desc@1.4.2',
  'devtools@2.4.5',
  'diffobj@0.3.5',
  'digest@0.6.31',
  'downlit@0.4.2',
  'ellipsis@0.3.2',
  'evaluate@0.20',
  'fansi@1.0.4',
  'fastmap@1.1.1',
  'fontawesome@0.5.0',
  'fs@1.6.1',
  'gert@1.9.2',
  'gh@1.4.0',
  'gitcreds@0.1.2',
  'glue@1.6.2',
  'here@1.0.1',
  'highr@0.10',
  'htmltools@0.5.5',
  'htmlwidgets@1.6.2',
  'httpuv@1.6.9',
  'httr@1.4.5',
  'httr2@0.2.2',
  'ini@0.3.1',
  'jquerylib@0.1.4',
  'jsonlite@1.8.4',
  'knitr@1.42',
  'later@1.3.0',
  'lattice@0.20-45',
  'lazyeval@0.2.2',
  'lifecycle@1.0.3',
  'magrittr@2.0.3',
  'memoise@2.0.1',
  'mime@0.12',
  'miniUI@0.1.1.1',
  'openssl@2.0.6',
  'packrat@0.9.1',
  'pillar@1.9.0',
  'pkgbuild@1.4.0',
  'pkgconfig@2.0.3',
  'r-lib/pkgdown@HEAD',
  'pkgload@1.3.2',
  'png@0.1-8',
  'praise@1.0.0',
  'prettyunits@1.1.1',
  'processx@3.8.0',
  'profvis@0.3.7',
  'promises@1.2.0.1',
  'ps@1.7.4',
  'purrr@1.0.1',
  'ragg@1.2.5',
  'rappdirs@0.3.3',
  'rcmdcheck@1.4.0',
  'rematch2@2.1.2',
  'remotes@2.4.2',
  'reticulate@1.28',
  'rex@1.2.1',
  'rlang@1.1.0',
  'rmarkdown@2.21',
  'roxygen2@7.2.3',
  'rprojroot@2.0.3',
  'rstudioapi@0.14',
  'rversions@2.1.2',
  'sass@0.4.5',
  'sessioninfo@1.2.2',
  'shiny@1.7.4',
  'sourcetools@0.1.7-1',
  'stringi@1.7.12',
  'stringr@1.5.0',
  'sys@3.4.1',
  'systemfonts@1.0.4',
  'testthat@3.1.7',
  'textshaping@0.3.6',
  'tibble@3.2.1',
  'tinytex@0.44',
  'urlchecker@1.0.1',
  'usethis@2.1.6',
  'utf8@1.2.3',
  'uuid@1.1-0',
  'vctrs@0.6.1',
  'waldo@0.4.0',
  'whisker@0.4.1',
  'withr@2.5.0',
  'xfun@0.38',
  'xml2@1.3.3',
  'xopen@1.0.0',
  'xtable@1.8-4',
  'yaml@2.3.7',
  'zip@2.2.2'
)

.libPaths(tempdir())
install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
pak::pkg_install(remotes)

I see:

Error in !version_satisfies(candidate$version, resolution$remote[[1]]$atleast,  : 
  invalid argument type

Here's what I see for resolution$remote[[1]]:

List of 1
 $ :List of 6
  ..$ package: chr "R6"
  ..$ atleast: chr ""
  ..$ version: chr "2.5.1"
  ..$ ref    : chr "R6@2.5.1"
  ..$ type   : chr "standard"
  ..$ params : chr(0) 
  ..- attr(*, "class")= chr [1:3] "remote_ref_standard" "remote_ref" "list"

And:

> .Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error: 
! error in pak subprocess
Caused by error in `!version_satisfies(candidate$version, resolution$remote[[1]]$atleast, …`:
! invalid argument type
---
Backtrace:
1. pak::pkg_install(remotes)
2. pak:::remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...), …
3. err$throw(res$error)
---
Subprocess backtrace:
 1. base::withCallingHandlers(cli_message = function(msg) { …
 2. get("pkg_install_make_plan", asNamespace("pak"))(...)
 3. prop$solve()
 4. private$plan$solve(policy = private$policy)
 5. pkgdepends:::pkgplan_solve(self, private, match.arg(policy))
 6. private$create_lp_problem(pkgs, policy)
 7. pkgdepends:::pkgplan__create_lp_problem(self, private, pkgs, policy)
 8. pkgdepends:::pkgplan_i_create_lp_problem(pkgs, private$config, policy)
 9. pkgdepends:::pkgplan_i_lp_satisfy_direct(lp)
10. base::lapply(seq_len(lp$num_candidates)[lp$pkgs$direct], satisfy)
11. local FUN(X[[i]], ...)
12. base::isTRUE(satisfies_remote(res, res2))
13. pkgdepends:::satisfies_remote(res, res2)
14. local sat(resolution, candidate, config, ...)
15. base::.handleSimpleError(function (e) …
16. global h(simpleError(msg, call))
gaborcsardi commented 1 year ago

Versioned CRAN packages are only supported by the devel version: https://pak.r-lib.org/dev/reference/install.html#nightly-builds

kevinushey commented 1 year ago

You're right! It works; sorry about that.