r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
682 stars 63 forks source link

Should `Failed to download {pkg}` fail immediately? #429

Open DavisVaughan opened 2 years ago

DavisVaughan commented 2 years ago

https://github.com/tidyverse/dplyr/actions/runs/3420263220/jobs/5694855875#step:5:3380

As part of this run, you can see this message

✖ Failed to download rcmdcheck 1.4.0 (source)

But it doesn't stop there, the installation process continues and we finally get an obscure error here:

 ℹ Building rcmdcheck 1.4.0

  Error: Error: <callr_remote_error: `path` must exist>
   in process 9537 
  -->
  <simpleError: `path` must exist>

   Stack trace:

   12. (function (...)  ...
   13. base:::withCallingHandlers(cli_message = function(msg) { ...
   14. get("lockfile_install_internal", asNamespace("pak"))(...)
   15. plan$install()
   16. pkgdepends:::install_package_plan(plan, lib = private$library,  ...
   17. base:::withCallingHandlers({ ...
   18. pkgdepends:::start_task(state, task)
   19. pkgdepends:::start_task_build(state, task)
   20. pkgdepends:::make_build_process(path, pkg, tmp_dir, lib, vignettes,  ...
   21. withr::with_libpaths(c(tmplib, lib), action = "prefix", pkgbuild_process$ne ...
   22. base:::force(code)
   23. pkgbuild_process$new(path, tmp_dir, binary = binary, vignettes = vignettes, ...
   24. pkgbuild:::initialize(...)
   25. pkgbuild:::rcb_init(self, private, super, path, dest_path, binary,  ...
   26. pkgbuild:::build_setup(path, dest_path, binary, vignettes, manual,  ...
   27. base:::stop("`path` must exist", call. = FALSE)
   28. base:::.handleSimpleError(function (e)  ...
   29. h(simpleError(msg, call))
   30. base:::stop(e)
   31. (function (e)  ...

   x `path` must exist 

We wondered if possibly this should have exited earlier when the package couldn't be downloaded

DavisVaughan commented 1 month ago

Just hit this again on CI!

  ℹ Installing lockfile '.github/pkg.lock'

  → Will install 7 packages.
  → Will download 2 CRAN packages (5.59 MB).
  → Will download 5 packages with unknown size.
  + data.table   1.16.2 👷🏽🔧 ⬇ (5.49 MB)
  + evaluate     1.0.0   ⬇ (101.80 kB)

  ℹ Getting 2 pkgs (5.59 MB)
  ✔ Cached copy of lattice 0.22-6 (aarch64-apple-darwin20) is the latest build
  ✔ Cached copy of MASS 7.3-60.2 (aarch64-apple-darwin20) is the latest build
  ✔ Cached copy of Matrix 1.7-0 (aarch64-apple-darwin20) is the latest build
  ✔ Cached copy of mgcv 1.9-1 (aarch64-apple-darwin20) is the latest build
  ✔ Cached copy of nlme 3.1-164 (aarch64-apple-darwin20) is the latest build
  ✖ Failed to download evaluate 1.0.0 (aarch64-apple-darwin20)
  ✔ Got data.table 1.16.2 (source) (5.49 MB)
  ℹ Building data.table 1.16.2
  ✔ Built data.table 1.16.2 (14.2s)
  Error: 
  ! error in pak subprocess
  Caused by error in `file(con, "rb")`:
  ! cannot open the connection
  ---
  Backtrace:
  1. pak::lockfile_install(".github/pkg.lock")
  2. pak:::remote(function(...) { …
  3. err$throw(res$error)
  ---
  Subprocess backtrace:
   1. base::withCallingHandlers(cli_message = function(msg) { …
   2. get("lockfile_install_internal", asNamespace("pak"))(...)
   3. plan$install()
   4. pkgdepends::install_package_plan(plan, lib = private$library, num_workers = nw, …
   5. base::withCallingHandlers({ …
   6. pkgdepends:::start_task(state, task)
   7. pkgdepends:::start_task_install(state, task)
   8. pkgdepends:::make_install_process(filename, lib = lib, metadata = metadata)
   9. pkgdepends:::detect_package_archive_type(filename)
  10. base::readBin(file, what = "raw", n = 6)
  11. base::file(con, "rb")
  12. base::.handleSimpleError(function (e) …
  13. global h(simpleError(msg, call))
  Execution halted