Skip to content
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

pak fails in github action (windows): error in pkgs$platform[winbin] <- ifelse(is.na(archs) | archs %in% c("i386,x64", … #448

Closed
MLopez-Ibanez opened this issue Dec 14, 2022 · 8 comments · Fixed by r-lib/pkgdepends#298
Labels
bug an unexpected problem or unintended behavior

Comments

@MLopez-Ibanez
Copy link

 shell: C:\R\bin\Rscript.EXE {0}
 env:
   pythonLocation: C:\hostedtoolcache\windows\Python\3.7.9\x64
   PKG_CONFIG_PATH: C:\hostedtoolcache\windows\Python\3.7.9\x64/lib/pkgconfig
   Python_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
   Python2_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
   Python3_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
   _R_INSTALL_TIME_PATCHES_: no
   R_LIBS_USER: D:\a\_temp\Library
   TZ: UTC
   _R_CHECK_SYSTEM_CLOCK_: FALSE
   NOT_CRAN: true
   RSPM: https://packagemanager.rstudio.com/all/latest
   RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.rstudio.com/all/latest
   R_LIB_FOR_PAK: C:/R/site-library
 ##[endgroup]
 ##[group]Install/update packages
 ℹ Installing lockfile '.github/pkg.lock'
 Error: 
 ! error in pak subprocess
 Caused by error in `pkgs$platform[winbin] <- ifelse(is.na(archs) | archs %in% c("i386,x64", …`:
 ! replacement has length zero
 ---
 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$update()
 4. pkgdepends:::pkg_lockfile_update(self, private)
 5. private$plan$update()
 6. pkgdepends:::pkgplan_update(self, private)
 7. pkgdepends:::make_installed_cache(private$config$get("library"))
 8. base::.handleSimpleError(function (e) …
 9. global h(simpleError(msg, call))
 Execution halted
@gaborcsardi
Copy link
Member

gaborcsardi commented Dec 14, 2022

Can you link to the failing build?

@MLopez-Ibanez
Copy link
Author

@MLopez-Ibanez
Copy link
Author

Deleting the cache fixed it. Let me see what happens if I use the cache again...

@MLopez-Ibanez
Copy link
Author

Deleting the cache fixed it. Let me see what happens if I use the cache again...

It fails again. So it seems the problem is caused by the presence of the github actions cache: https://github.com/auto-optimization/iracepy/blob/main/.github/workflows/test.yml

@gaborcsardi
Copy link
Member

Can you try pak-version: devel to see if this has been fixed already?

@MLopez-Ibanez
Copy link
Author

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Dec 14, 2022
@gaborcsardi
Copy link
Member

It seems that this is an edge case in base R / CRAN. Your package does have a /src directory, but it does not have a library. The compiled code creates a couple of binaries in /bin/<arch> (in the installed package) instead.

Which is all fine, but because of the missing library, the base R packaging tools do not add an Archs entry to the metadata for your package, even though it is clearly not-architecture independent. I.e. https://cran.r-project.org/bin/windows/contrib/4.2/PACKAGES has:

Package: irace
Version: 3.5
Depends: R (>= 3.2.0)
Imports: stats, utils, compiler, R6
Suggests: Rmpi (>= 0.6.0), parallel, knitr, testthat, withr, mlr (>=
        2.15.0), ParamHelpers, devtools, covr
License: GPL (>= 2)

without an Archs: x64 entry.

IDK if there is anything you could do to have this fixed on CRAN.

For pak, we'll assume that the binary is x64 only for R 4.2.0 and above, and that it is i386 + x64 for older R versions. This should work well in practice.

@gaborcsardi
Copy link
Member

A fix is now deployed in pak-version: devel, so hopefully it works now.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Feb 19, 2023
# pak 0.4.0

* pak has much improved and more informative error messages now.
  This work is not yet finished, so if you find an unclear error message,
  please open an issue. Thank you!

* The solver is now more robust for non-canonical input (e.g. `DESCRIPTION`
  files) (r-lib/pak#423).

* Better installation output. Standard output and error are now
  collected together (r-lib/pkgdepends@0669f0f8c).

* The solver is now doing a better job when multiple versions of the
  same package are present in the same repository
  (r-lib/actions#559).

* `pkg_name_check()` now works again, it needed a fix after changes at
  https://crandb.r-pkg.org.

* Explicit package names in local and URL package sources, as in
  `package=local::...` or `package=url::...` are now parsed correctly in
  dependencies.

* pak is now more robust to `Archs` fields missing from the CRAN
  metadata for packages with compiled code
  (r-lib/pak#448).

* `url::` packages now always work correctly, even if the digest package is
  not installed (r-lib/pak#433).

* pak is now more robust when installing packages from subdirectories
  of GitHub repositories (r-lib/pak#431,
  @paleolimbot).

* Parameters `?reinstall`, `?source` and `?ignore` now work correctly when
  specified in the `package=?parameter` format (#294).

* The `?ignore` parameter works correctly now.

* Dependency resolution now does not fail if a package is not found.

* pak can now install `url::` remotes from GitHub.

* pak now does not fail when the package of a `.tar.gz` GitHub
  snapshot is in a subdirectory, or in a subdirectory of a subdirectory.

* pak now errors early if it cannot deduce the name of the package
  from a `Remotes` or `Config/Needs/*` entry.

* Solver failures now include details in some cases where previously they
  did not.

* pak can now update packages in Docker containers where the
  old version was installed in the different Docker later
  (r-lib/pak#251)

* Update R version -> Bioconductor version mapping. R 4.2.x now maps to
  Bioconductor 3.16.
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

Successfully merging a pull request may close this issue.

2 participants