-
Notifications
You must be signed in to change notification settings - Fork 154
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::update()
does not respect source repository with multiple repos
#1918
Comments
Right, the intention was the latter -- for packages installed from a CRAN-like repository, any available CRAN-like repository will be considered a candidate when checking for updates. It seems reasonable to restrict this in certain scenarios, though -- it might take some thought to figure out how to best make that work. |
Thank you for the clarification! I agree that it could be useful to track individual repos for updates, or at least restrict updates to certain repos. In the example above, it would be convenient if only CRAN packages could be updated without having to manually specify |
I would definitely support this, I'd want to be able to run
I use Rocker, with the last-but-one version of R, and set the repos by default to https://p3m.dev/cran/__linux__/noble/2025-02-27 , for example, with the date set to the latest date that version was the latest. So when a new version of R comes round, I want to update packages using renv, but only to that date in the past. |
@shug0131 what about running something like:
|
THanks for the suggestion, it would seem to be a good solution. But I looked into what was the value to So trying to set up a fresh blank project in a new empty directory. I get the follwoing error
|
@shug0131 can you share the output of |
I've found that
renv::update()
does not respect the recorded source repository for packages that have different versions available in different repos. I've prepared the following minimal reproducible example (https://github.com/kthayashi/stan-renv-reprex) to demonstrate this:For this example, let's say that I'm working with three packages that are distributed as follows:
brms
: release version on CRANloo
: release version on CRAN + development version on R-Universecmdstanr
: release version on R-UniverseSome of these packages have dependencies (e.g.
bayesplot
) that also have the same distribution mode asloo
. I would like to use release versions when possible, so I installbrms
andcmdstanr
from CRAN and R-Universe, respectively. And let's say that I need a feature in the development version ofloo
, so I installloo
from R-Universe.renv
version:Repo configuration:
Excerpts from
renv.lock
:Based on the description for
renv::update()
, I expected packages installed from CRAN (with"Repository": "CRAN"
in itsrenv.lock
entry) will be updated according to the version available on CRAN:However,
renv::update()
attempts to update packages to the newest version across all repos:All the items listed under
Stan
here were initially installed from CRAN and recorded inrenv.lock
as such, butrenv::update()
attempts to replace these with development versions from R-Universe. I was wondering if this is unexpected behavior, or if this is simply a case where "Updates will only be checked from the same source" actually means CRAN (or CRAN-like repo) vs. GitHub with no way to distinguish between different sources ingetOption("repos")
.The text was updated successfully, but these errors were encountered: