Skip to content

Dependency resolution error for "deps::." when forcing platform #522

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

Closed
krlmlr opened this issue Jul 7, 2023 · 10 comments
Closed

Dependency resolution error for "deps::." when forcing platform #522

krlmlr opened this issue Jul 7, 2023 · 10 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@krlmlr
Copy link
Member

krlmlr commented Jul 7, 2023

Currently:

Package source: digest_0.6.32.tar.gz
Windows binaries: r-devel: digest_0.6.32.zip, r-release: digest_0.6.32.zip, r-oldrel: digest_0.6.31.zip
macOS binaries: r-release (arm64): digest_0.6.31.tgz, r-oldrel (arm64): digest_0.6.31.tgz, r-release (x86_64): digest_0.6.32.tgz, r-oldrel (x86_64): digest_0.6.32.tgz
Old sources: digest archive

Trying to Sys.setenv(PKG_PLATFORMS = "aarch64-apple-darwin20") according to #496 (comment) leads to:

pkgdepends::default_platforms()
#> [1] "aarch64-apple-darwin20" "source"
writeLines("Package: foo\nVersion: 1.0.0\nSuggests: digest", "DESCRIPTION")
Sys.setenv(PKG_PLATFORMS = "aarch64-apple-darwin20")
pak::pak()
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> Error: ! error in pak subprocess
#> Caused by error: 
#> ! Could not solve package dependencies:
#> * deps::/private/var/folders/dj/yhk9rkx97wn_ykqtnmk18xvc0000gn/T/RtmpQzeqqa/reprex-fc90c4039d3-ivory-pewee: Platform mismatch

Created on 2023-07-07 with reprex v2.0.2

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.3 (2023-03-15)
#>  os       macOS Ventura 13.4.1
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Berlin
#>  date     2023-07-07
#>  pandoc   3.1.3 @ /opt/homebrew/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  callr         3.7.3      2022-11-02 [1] CRAN (R 4.2.0)
#>  cli           3.6.1      2023-03-23 [1] CRAN (R 4.2.0)
#>  crayon        1.5.2      2022-09-29 [1] CRAN (R 4.2.0)
#>  curl          5.0.1      2023-06-07 [1] CRAN (R 4.2.0)
#>  debugme       1.1.0      2017-10-22 [1] CRAN (R 4.2.0)
#>  desc          1.4.2      2022-09-08 [1] CRAN (R 4.2.0)
#>  digest        0.6.31     2022-12-11 [1] CRAN (R 4.2.0)
#>  evaluate      0.21       2023-05-05 [1] CRAN (R 4.2.0)
#>  fansi         1.0.4      2023-01-22 [1] CRAN (R 4.2.0)
#>  fastmap       1.1.1      2023-02-24 [1] CRAN (R 4.2.0)
#>  filelock      1.0.2      2018-10-05 [1] CRAN (R 4.2.0)
#>  fs            1.6.2      2023-04-25 [1] CRAN (R 4.2.0)
#>  glue          1.6.2      2022-02-24 [1] CRAN (R 4.2.0)
#>  htmltools     0.5.5      2023-03-23 [1] CRAN (R 4.2.0)
#>  jsonlite      1.8.7      2023-06-29 [1] CRAN (R 4.2.0)
#>  knitr         1.43       2023-05-25 [1] CRAN (R 4.2.3)
#>  lifecycle     1.0.3      2022-10-07 [1] CRAN (R 4.2.0)
#>  lpSolve       5.6.18     2023-02-01 [1] CRAN (R 4.2.0)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.2.0)
#>  pak           0.5.1.9000 2023-06-18 [1] local
#>  pillar        1.9.0      2023-03-22 [1] CRAN (R 4.2.0)
#>  pkgbuild      1.4.1      2023-06-14 [1] CRAN (R 4.2.3)
#>  pkgcache      2.1.1.9000 2023-06-19 [1] Github (r-lib/pkgcache@bb8c2d5)
#>  pkgdepends    0.5.0.9000 2023-06-19 [1] Github (r-lib/pkgdepends@6741f04)
#>  prettyunits   1.1.1      2020-01-24 [1] CRAN (R 4.2.0)
#>  processx      3.8.2      2023-06-30 [1] CRAN (R 4.2.0)
#>  ps            1.7.5      2023-04-18 [1] CRAN (R 4.2.0)
#>  purrr         1.0.1      2023-01-10 [1] CRAN (R 4.2.0)
#>  R.cache       0.16.0     2022-07-21 [1] CRAN (R 4.2.0)
#>  R.methodsS3   1.8.2      2022-06-13 [1] CRAN (R 4.2.0)
#>  R.oo          1.25.0     2022-06-12 [1] CRAN (R 4.2.0)
#>  R.utils       2.12.2     2022-11-11 [1] CRAN (R 4.2.0)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.2.0)
#>  rappdirs      0.3.3      2021-01-31 [1] CRAN (R 4.2.0)
#>  reprex        2.0.2      2022-08-17 [1] CRAN (R 4.2.0)
#>  rlang         1.1.1      2023-04-28 [1] CRAN (R 4.2.0)
#>  rmarkdown     2.23       2023-07-01 [1] CRAN (R 4.2.0)
#>  rprojroot     2.0.3      2022-04-02 [1] CRAN (R 4.2.0)
#>  rstudioapi    0.14       2022-08-22 [1] CRAN (R 4.2.0)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.2.0)
#>  styler        1.10.1     2023-06-05 [1] CRAN (R 4.2.0)
#>  utf8          1.2.3      2023-01-31 [1] CRAN (R 4.2.0)
#>  vctrs         0.6.3      2023-06-14 [1] CRAN (R 4.2.3)
#>  withr         2.5.0      2022-03-03 [1] CRAN (R 4.2.0)
#>  xfun          0.39       2023-04-20 [1] CRAN (R 4.2.0)
#>  yaml          2.3.7      2023-01-23 [1] CRAN (R 4.2.0)
#>  zip           2.3.0      2023-04-17 [1] CRAN (R 4.2.0)
#> 
#>  [1] /Users/kirill/Library/R/arm64/4.2/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
@krlmlr krlmlr changed the title Dependency resolution error when forcing platform. Dependency resolution error when forcing platform Jul 7, 2023
@krlmlr
Copy link
Member Author

krlmlr commented Jul 7, 2023

Upstream digest issue: eddelbuettel/digest#189 .

@gaborcsardi: Situations like this may occur, what's a good way to deal with them? Currently, running pak::pak() doesn't work for many repos for me.

@gaborcsardi
Copy link
Member

There is no good way, AFAICT.

@gaborcsardi
Copy link
Member

Fwiw if you use 'upgrade=FALSE', which is the default in setup-r-dependencies, then pak will install the older binary package, unless the newer version is needed by another dependency.

@krlmlr
Copy link
Member Author

krlmlr commented Jul 7, 2023

What would an equivalent pkgdepends (?) reprex look like?

@gaborcsardi
Copy link
Member

Actually, if the problem is a broken package version, then fixing that package to a version that is known to be OK, like you did, is a pretty good solution, I think.

@gaborcsardi
Copy link
Member

Re the original error, I get

❯ pak::pkg_install("deps::.")
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:
* deps::.: Platform mismatch
Type .Last.error to see the more details.

because the deps:: "package" is considered as source. So that's a bug.

For other package sources, the binary is correctly selected:

❯ pak::pkg_install("digest?reinstall&nocache")

→ Will install 1 package.
→ Will download 1 CRAN package (273.60 kB).
+ digest   0.6.31  ⬇ (273.60 kB)
ℹ Getting 1 pkg (273.60 kB)
✔ Got digest 0.6.31 (aarch64-apple-darwin20) (273.60 kB)
✔ Downloaded 1 package (273.60 kB)in 1.4s
✔ Installed digest 0.6.31  (33ms)
✔ 1 pkg: added 1, dld 1 (273.60 kB) [1.7s]

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Jul 7, 2023
@krlmlr krlmlr changed the title Dependency resolution error when forcing platform Dependency resolution error for "deps::." when forcing platform Jul 7, 2023
@krlmlr
Copy link
Member Author

krlmlr commented Jul 7, 2023

Thanks, good catch. I thought this was about digest when it was about the local package.

@gaborcsardi
Copy link
Member

Actually, the correct test is with upgrade = TRUE, because the default upgrade = FALSE always selects the binary. But that's the same:

❯ Sys.setenv(PKG_PLATFORMS = "aarch64-apple-darwin20")
❯ pak::pkg_install("digest?reinstall&nocache", upgrade = TRUE)

→ Will install 1 package.
→ Will download 1 CRAN package (273.60 kB).
+ digest   0.6.31  ⬇ (273.60 kB)
ℹ Getting 1 pkg (273.60 kB)
✔ Got digest 0.6.31 (aarch64-apple-darwin20) (273.60 kB)
✔ Downloaded 1 package (273.60 kB)in 689ms
✔ Installed digest 0.6.31  (33ms)
✔ 1 pkg: added 1, dld 1 (273.60 kB) [996ms]

@gaborcsardi
Copy link
Member

Reprex:

library(pkgdepends)
dir.create(pkg <- tempfile())
dir.create(lib <- tempfile())
setwd(pkg)
Sys.setenv(PKG_PLATFORMS = current_r_platform())
writeLines("Package: foo\nVersion: 1.0.0\nSuggests: digest", "DESCRIPTION")
p <- new_pkg_installation_proposal("deps::.", config = list(library = lib))
p$solve()
p$show_solution()
#> Error: ! Could not solve package dependencies:
#> * deps::.: Platform mismatch

Created on 2023-07-07 with reprex v2.0.2

gaborcsardi referenced this issue in r-lib/pkgdepends Jul 9, 2023
@gaborcsardi
Copy link
Member

Closed by r-lib/pkgdepends@f7179f7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants