r-lib / pkgdepends

R Package Dependency Resolution
https://r-lib.github.io/pkgdepends/
Other
102 stars 30 forks source link

Unexpected version of dependency installed when minimum version specified #251

Open richfitz opened 3 years ago

richfitz commented 3 years ago

I think this is what is going on. We have a package sircovid that depends on other internal packages dust and mcstate with

Imports:
    dust (>= 0.9.2),
    eigen1 (>= 0.1.1),
    mcstate (>= 0.4.0),
    socialmixr

(see https://github.com/mrc-ide/sircovid/blob/fd042fa2f7320b2d8364a9ea1b898d957167f18e/DESCRIPTION#L57-L61)

If I prepare a pkgdepends solution like this, I will end up with versions of the packages that correspond to the version in the DESCRIPTION and not the newest in the repo:

options(repos = c(ncov = "https://ncov-ic.github.io/drat",
                  CRAN = "https://cloud.r-project.org"))
empty <- tempfile()
dir.create(empty)
proposal <- pkgdepends::new_pkg_installation_proposal(
  "sircovid", list(library = empty), policy = "lazy")
proposal$solve()
proposal$show_solution()

giving

+ dust          0.9.2    [bld][cmp]
...
+ mcstate       0.4.0    [bld]
...
+ sircovid      0.11.5   [bld][cmp]
Full output ``` + askpass 1.1 [bld][cmp] + callr 3.7.0 [bld][dl] (74.52 kB) + cli 2.5.0 [bld][dl] (158.16 kB) + countrycode 1.2.0 [bld] + cpp11 0.2.7 [bld] + crayon 1.4.1 [bld] + curl 4.3.1 [bld][cmp][dl] (793.23 kB) + data.table 1.14.0 [bld][cmp][dl] (5.30 MB) + desc 1.3.0 [bld] + dust 0.9.2 [bld][cmp] + eigen1 0.1.1 [bld][cmp] + ellipsis 0.3.2 [bld][cmp][dl] (8.07 kB) + fansi 0.5.0 [bld][cmp][dl] (301.72 kB) + generics 0.1.0 [bld] + glue 1.4.2 [bld][cmp] + hms 1.1.0 [bld][dl] (43.14 kB) + httr 1.4.2 [bld] + jsonlite 1.7.2 [bld][cmp][dl] (421.72 kB) + lifecycle 1.0.0 [bld] + lubridate 1.7.10 [bld][cmp][dl] (473.55 kB) + magrittr 2.0.1 [bld][cmp] + mcstate 0.4.0 [bld] + mime 0.10 [bld][cmp][dl] (13.05 kB) + oai 0.3.2 [bld][dl] (132.84 kB) + openssl 1.4.4 [bld][cmp][dl] (1.31 MB) + pillar 1.6.1 [bld][dl] (1.11 MB) + pkgbuild 1.2.0 [bld] + pkgconfig 2.0.3 [bld] + pkgload 1.2.1 [bld][cmp][dl] (60.65 kB) + plyr 1.8.6 [bld][cmp] + prettyunits 1.1.1 [bld] + processx 3.5.2 [bld][cmp][dl] (141.42 kB) + progress 1.2.2 [bld] + ps 1.6.0 [bld][cmp] + R6 2.5.0 [bld] + Rcpp 1.0.6 [bld][cmp] + rlang 0.4.11 [bld][cmp][dl] (861.73 kB) + rprojroot 2.0.2 [bld] + rstudioapi 0.13 [bld] + sircovid 0.11.5 [bld][cmp] + socialmixr 0.1.8 [bld][dl] (434.77 kB) + stringi 1.6.2 [bld][cmp][dl] (7.58 MB) + stringr 1.4.0 [bld] + sys 3.4 [bld][cmp] + tibble 3.1.2 [bld][cmp][dl] (686.14 kB) + utf8 1.2.1 [bld][cmp] + vctrs 0.3.8 [bld][cmp][dl] (782.61 kB) + withr 2.4.2 [bld][dl] (94.28 kB) + wpp2015 1.1-2 [bld] + XML 3.99-0.6 [bld][cmp][dl] (968.77 kB) + xml2 1.3.2 [bld][cmp] ```

However, the most recent versions of dust and mcstate in the repo are dust:0.9.3 (binaries and source) and mcstate:0.6.0

If I add these dependencies to the package list explicitly I get the most recent version. So it looks from the outside that the solver is preferring the minimum version rather than the newest version.

gaborcsardi commented 2 years ago

I am sorry for the long wait, the situation is somewhat different now of course. AFAICT the newest version of dust is installed now, dust 0.11.20, while at least 0.11.19 was requested. For the other two packages the latest versions are required, so hard to tell there.

So do you think this is OK now? Do you have another example?

richfitz commented 2 years ago

Thanks for the follow up - I should be able to restore the package repository to a previous version to check if this can be replicated. Let me know if that would be useful.

No other odd cases, though we did get a completely incredible case where an old version of a package was being installed when certain users generated scripts on certain machines - took us several hours and we never nailed it down.