r-lib / pkgdepends

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

Installation error, new in recent pkgdepends #282

Closed richfitz closed 2 years ago

richfitz commented 2 years ago

Hi Gabor,

We've hit an issue installing packages with pkgdepends, somewhere between version 0.1.1 and 0.3.1 - MRE below:

tmp <- tempfile()
dir.create(tmp)
packages <- c("github::mrc-ide/naomi", "github::mrc-ide/first90release")
config <- list(library = tmp)
proposal <- pkgdepends::new_pkg_installation_proposal(packages, config,
                                                      policy = "lazy")
proposal$solve()
proposal$stop_for_solution_error()
proposal$download()
proposal$stop_for_download_error()
proposal$install()

this fails at the install step with

Error in done[[i]] : subscript out of bounds
> traceback()
6: do(m)
5: do(m)
4: do(i)
3: add_recursive_dependencies(plan)
2: install_package_plan(plan, lib = private$library, num_workers = nw, 
       cache = cache)
1: proposal$install()

I think this is probably the same error as https://github.com/r-lib/actions/issues/534 which you said there was a pak bug

Unfortunately we can't remove the Remotes fields from these packages - that's the suggestion on the other issue - as this is widespread across our cluster installation. We're going to try downgrading in the meantime though.

We did dig into the error and it's a bit of a mystery to us - the code around the error is old but looks like trying to mark "stringi" as done or not is causing the issue - perhaps some issue in how deps are being calculated? But I have no idea really sorry.

gaborcsardi commented 2 years ago

Have you tried the dev version of pkgdepends?

richfitz commented 2 years ago

Sorry, this was with a version installed today via install_github from master (so 0.3.1.9000) (looks like github has changed keyboard shortcuts and ctrl-enter closes an issue now :upside_down_face: )

gaborcsardi commented 2 years ago

This is definitely a bug in pkgdepends. It is triggered by referring to a GH package with a different name than its repo. Here is a possible workaround until we fix this: https://github.com/mrc-ide/naomi/pull/323

richfitz commented 2 years ago

I'm afraid we've hit what looks like the same bug again, but without any package renaming that we can see:

tmp <- tempfile()
dir.create(tmp)
packages <- "github::mrc-ide/malariasimulation"
config <- list(library = tmp)
proposal <- pkgdepends::new_pkg_installation_proposal(packages, config,
                                                      policy = "lazy")
proposal$solve()
proposal$stop_for_solution_error()
proposal$download()
proposal$stop_for_download_error()
proposal$install()

Fails with:

Error in done[[i]] : subscript out of bounds
> traceback()
7: do(m)
6: do(m)
5: do(m)
4: do(i)
3: add_recursive_dependencies(plan)
2: install_package_plan(plan, lib = private$library, num_workers = nw, 
       cache = cache)
1: proposal$install()
gaborcsardi commented 2 years ago

Hmmm, this does not fail for me. R 4.2.1, macOS arm64, pkgdepends from GH. Can you pls send a session info? Thanks.

richfitz commented 2 years ago

Sorry, here you go:

> sessioninfo::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.2.1 (2022-06-23)
 os       Ubuntu 20.04.4 LTS          
 system   x86_64, linux-gnu           
 ui       X11                         
 language en_GB:en                    
 collate  en_GB.UTF-8                 
 ctype    en_GB.UTF-8                 
 tz       Europe/London               
 date     2022-08-12                  

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version    date       lib source                           
 callr         3.7.1      2022-07-13 [1] CRAN (R 4.2.0)                   
 cli           3.3.0      2022-04-25 [1] CRAN (R 4.2.0)                   
 crayon        1.5.1      2022-03-26 [1] CRAN (R 4.2.0)                   
 curl          4.3.2      2021-06-23 [1] CRAN (R 4.1.1)                   
 debugme       1.1.0      2017-10-22 [1] CRAN (R 4.0.3)                   
 desc          1.4.1      2022-03-06 [1] CRAN (R 4.2.0)                   
 fansi         1.0.3      2022-03-24 [1] CRAN (R 4.2.0)                   
 filelock      1.0.2      2018-10-05 [1] CRAN (R 4.0.3)                   
 glue          1.6.2      2022-02-24 [1] CRAN (R 4.2.0)                   
 jsonlite      1.8.0      2022-02-22 [1] CRAN (R 4.2.0)                   
 lifecycle     1.0.1      2021-09-24 [1] CRAN (R 4.2.0)                   
 lpSolve       5.6.15     2020-01-24 [1] CRAN (R 4.0.3)                   
 pillar        1.8.0      2022-07-18 [1] CRAN (R 4.2.0)                   
 pkgbuild      1.3.1      2021-12-20 [1] CRAN (R 4.2.1)                   
 pkgcache      2.0.1      2022-02-18 [1] CRAN (R 4.2.1)                   
 pkgdepends    0.3.1.9000 2022-08-12 [1] Github (r-lib/pkgdepends@d1b2923)
 prettyunits   1.1.1      2020-01-24 [1] CRAN (R 4.0.3)                   
 processx      3.7.0      2022-07-07 [1] CRAN (R 4.2.0)                   
 ps            1.7.1      2022-06-18 [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.1.0)                   
 rlang         1.0.4      2022-07-12 [1] CRAN (R 4.2.0)                   
 rprojroot     2.0.3      2022-04-02 [1] CRAN (R 4.2.0)                   
 rstudioapi    0.13       2020-11-12 [1] CRAN (R 4.1.0)                   
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 4.0.3)                   
 utf8          1.2.2      2021-07-24 [1] CRAN (R 4.2.0)                   
 vctrs         0.4.1      2022-04-13 [1] CRAN (R 4.2.0)                   
 withr         2.5.0      2022-03-03 [1] CRAN (R 4.2.0)                   
 zip           2.2.0      2021-05-31 [1] CRAN (R 4.1.0)                   

[1] /home/rfitzjoh/lib/R/library
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library
gaborcsardi commented 2 years ago

This is another bug, a workaround is to put testthat in Imports as well, in individual, in addition to LinkingTo. (On Linux, when building from source, it does not matter, anyway).

tmp <- tempfile()
dir.create(tmp)
packages <- c("github::mrc-ide/malariasimulation", "testthat")
config <- list(library = tmp)
proposal <- pkgdepends::new_pkg_installation_proposal(packages, config, policy = "lazy")
proposal$solve()
proposal$stop_for_solution_error()
proposal$download()
proposal$stop_for_download_error()
proposal$install()
gaborcsardi commented 2 years ago

@richfitz Should be fixed now, thanks for the report and the reprex!