r-lib / pkgdepends

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

Source CRAN dependencies don't ignore MASS #368

Open jameslairdsmith opened 3 weeks ago

jameslairdsmith commented 3 weeks ago

I'm trying to install source packages on Windows using R version 4.3.3. I think I'm supposed to be allowed to use options(pkg.platforms = "source"). The problem is that when I do so, pkgdepends seems to want to find the latest version of the MASS dependency from CRAN, which insists on R >= 4.4.

library(pkgdepends)

options(pkg.platforms = "source",
        repos = list(CRAN = "https://cran.r-project.org/"))

deps <- new_pkg_deps("ggplot2")
deps$resolve()
#> ℹ Loading metadata database✔ Loading metadata database ... done
deps$solve()
deps$stop_for_solution_error()
#> Error: ! Could not solve package dependencies:
#> * ggplot2: Can't install dependency MASS
#> * MASS: Needs R >= 4.4.0
#> * MASS: Needs R >= 4.5
#> * MASS: Needs R >= 4.4
#> * installed::C:/PROGRA~1/R/R-43~1.3/library/MASS: Platform mismatch

Created on 2024-06-07 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.3 (2024-02-29 ucrt) #> os Windows 11 x64 (build 22631) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.utf8 #> ctype English_United States.utf8 #> tz Europe/London #> date 2024-06-07 #> pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.3) #> curl 5.2.1 2024-03-01 [1] CRAN (R 4.3.3) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.3.3) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.3) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.3) #> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.3) #> filelock 1.0.3 2023-12-11 [1] CRAN (R 4.3.3) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.3.3) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.3.3) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.3.3) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.3.3) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.3) #> lpSolve 5.6.20 2023-12-10 [1] CRAN (R 4.3.2) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.3) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.3) #> pkgcache 2.2.2 2024-04-04 [1] CRAN (R 4.3.3) #> pkgdepends * 0.7.2.9000 2024-06-07 [1] local #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.3) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.3) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.3) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.3.3) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.3.3) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.3) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.3.3) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.3.3) #> rmarkdown 2.26 2024-03-05 [1] CRAN (R 4.3.3) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.3.3) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.3) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.3.3) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.3) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.3) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.3.3) #> xfun 0.43 2024-03-25 [1] CRAN (R 4.3.3) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.2) #> #> [1] C:/Users/333573/AppData/Local/R/win-library/4.3 #> [2] C:/Program Files/R/R-4.3.3/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

My installed version of MASS doesn't have that dependency. That's why I figure it must be trying the CRAN version.

I'm using the development version of pkgdepends, but it happens on the CRAN version of pkgdepends too.

Some variations that also don't work:

I can get around this by not setting options(pkg.platforms = "source") and rather trying to find another way to get all the dependencies from source, but I figure that shouldn't be necessary. I suppose this hasn't happened to others because most people don't set that option.

gaborcsardi commented 3 weeks ago

source currently means that the package must be built from source.

jameslairdsmith commented 3 weeks ago

source currently means that the package must be built from source.

I suppose my issue is wondering whether that should extend to the "base" and "recommended" dependencies like MASS?