ITADN

renv::install(..., type = "binary") not always respected

#2264Openlgaborini 创建于 2026-04-10
L
lgaborinicommented
With {renv} 1.2.0, whenever a new package is released on CRAN, {renv} always tries to install the latest (source) version. This lasts a few days, probably until PPM is updated with the binary, or the package index is updated (I'm also encountering a separate "error code 22" issue on that, probably due to company policies) Not really a reprex (can't isolate the issue): - {cli} 3.6.6 released yesterday - {pak} does not seem to be requested (`renv::config$pak.enabled()` is FALSE) This is the output: ```r renv::install("cli", type = "binary") #> The following package(s) will be installed: #> - cli [3.6.6] #> These packages will be installed into "~/.renv/library/project/windows/R-4.5/x86_64-w64-mingw32". #> #> Do you want to proceed? [Y/n]: #> y #> #> # Downloading packages ------------------------------------------------------- #> ✖ cli 3.6.6 #> Successfully downloaded 1 package in 0.98 seconds. #> #> # Installing packages -------------------------------------------------------- #> (0/1) Building: cli #> #> Traceback (most recent calls last): #> 3: renv::install("cli", type = "binary") at #1 #> 2: renv_graph_install(descriptions) #> 1: socketSelect(sockets, write = FALSE, timeout = wait) ``` ## Possible issue location In `renv::install()` this is the line where the 3.6.6 version is explicitly returned inside `descriptions`: https://github.com/rstudio/renv/blob/492250b930a5c3a82b47aac9779fb4f824b58c9b/R/install.R#L234 Drilling down, `renv_graph_description_repository()` is called with `record = list(Package = "cli", Source = "Repository")`. Then, `renv_available_packages_entry()` is called first, and returns the reference to the 3.6.6 source version: https://github.com/rstudio/renv/blob/492250b930a5c3a82b47aac9779fb4f824b58c9b/R/graph.R#L219-L230 The `type` argument of `renv_available_packages_entry()` is not passed (it's still "source"). The `pkgType` option at this point is "binary". If I call `renv_available_packages_latest(package)` (normally called later but after the return), the 3.6.5 entry (binary) is correctly returned. ## Diagnostics ``` Diagnostics Report [renv 1.2.0] =============================== # Session Info --------------------------------------------------------------- R version 4.5.3 (2026-03-11 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631) Matrix products: default LAPACK version 3.12.1 locale: [1] LC_COLLATE=English_Switzerland.utf8 LC_CTYPE=English_Switzerland.utf8 [3] LC_MONETARY=English_Switzerland.utf8 LC_NUMERIC=C [5] LC_TIME=English_Switzerland.utf8 time zone: Europe/Zurich tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_4.5.3 tools_4.5.3 renv_1.2.0 ``` Repos: only CRAN ```r getOption("repos") #> CRAN #> "https://cloud.r-project.org" ``` Lockfile (if needed): - the current entry for {cli} came from CRAN (binary) - no custom repository set ```json "cli": { "Package": "cli", "Version": "3.6.5", "Source": "Repository", "Title": "Helpers for Developing Command Line Interfaces", ... "Config/Needs/website": "r-lib/asciicast, bench, brio, cpp11, decor, desc, fansi, prettyunits, sessioninfo, tidyverse/tidytemplate, usethis, vctrs", "Config/testthat/edition": "3", "Encoding": "UTF-8", "RoxygenNote": "7.3.2", "NeedsCompilation": "yes", "Author": "Gábor Csárdi [aut, cre], Hadley Wickham [ctb], Kirill Müller [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Posit Software, PBC [cph, fnd]", "Maintainer": "Gábor Csárdi <gabor@posit.co>", "Repository": "CRAN" }, ```
0 条评论