Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renv doesn't capture additional repos from install.packages(..., repos = "<repo>") #2104

Open
gowerc opened this issue Mar 4, 2025 · 1 comment

Comments

@gowerc
Copy link

gowerc commented Mar 4, 2025

I think this might be a regression as this was apparently implemented in #1175

If you installed a package via install.packages(..., repos = "<repo>") then <repo> isn't captured anywhere in the lock file and the lock file is thus not able to be restored.

Code to reproduce:

# Set repo where most recent version of renv is available from, but not too recent so we can install newer packages
options(repos = "https://packagemanager.posit.co/cran/2025-02-08")

install.packages("renv")
renv::init()   # and then Restart R

# Ensure correct url is stored in the initial lock file
options(repos = "https://packagemanager.posit.co/cran/2025-02-08")
renv::snapshot()

# data.table v1.17.0 was released on Feb 22, 2025 so won't be availabel in the 8th Feb snapshot used above
# May need to adjust environment variables to not link to an already installed/cached version
install.packages("data.table", repos = "https://packagemanager.posit.co/cran/2025-03-03" )
# insert a `library(data.table)` somewhere for R env to pick it up
renv::snapshot()

Then if you inspect the lock file:

    "Repositories": [
      {
        "Name": "CRAN",
        "URL": "https://packagemanager.posit.co/cran/2025-02-08"
      }
    ]
  },
........

    "data.table": {
      "Package": "data.table",
      "Version": "1.17.0",
      "Source": "Repository",
      "Title": "Extension of `data.frame`",
      "Depends": [
        "R (>= 3.3.0)"
      ],
      "Imports": [
        "methods"
      ],
      "Suggests": [
        "bit64 (>= 4.0.0)",
        "bit (>= 4.0.4)",
        "R.utils",
        "xts",
        "zoo (>= 1.8-1)",
        "yaml",
        "knitr",
        "markdown"
      ],
      "Description": "Fast aggregation of large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of columns by group using no copies at all, list columns, friendly and fast character-separated-value read/write. Offers a natural and flexible syntax, for faster development.",
      "License": "MPL-2.0 | file LICENSE",
      "URL": "https://r-datatable.com, https://Rdatatable.gitlab.io/data.table, https://github.com/Rdatatable/data.table",
      "BugReports": "https://github.com/Rdatatable/data.table/issues",
      "VignetteBuilder": "knitr",
      "Encoding": "UTF-8",
      "ByteCompile": "TRUE",
      "Authors" : <removed for brevity>
      "Authors@R" : <removed for brevity>
      "NeedsCompilation": "yes",
      "Maintainer": "Tyson Barrett <[email protected]>",
      "Repository": "CRAN"
    },

Key bit is "Repository" still points to "CRAN" even though the current CRAN url does not contain this version of data.table

@gowerc gowerc changed the title renv doesn't capture additional repos from install.packages(..., repos = "") renv doesn't capture additional repos from install.packages(..., repos = "<repo>") Mar 4, 2025
@kevinushey
Copy link
Collaborator

Thanks; I can confirm the issue -- I'll investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants