pak icon indicating copy to clipboard operation
pak copied to clipboard

Error: dependencies must be TRUE, FALSE, NA or a list of dependency types

Open krlmlr opened this issue 2 years ago • 3 comments

when passing both unqualified dependencies and "needs".

This doesn't fail in the reprex package for some reason, but I can replicate in a fresh session:

R -q -e 'unlink("dummy", force = TRUE); dir.create("dummy"); setwd("dummy"); install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel/"); pak::lockfile_create("roxygen2", dependencies = c("Config/Needs/check"))'
> unlink("dummy", force = TRUE); dir.create("dummy"); setwd("dummy"); install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel/"); pak::lockfile_create("roxygen2", dependencies = c("Config/Needs/check"))
trying URL 'https://r-lib.github.io/p/pak/devel/bin/macosx/big-sur-arm64/contrib/4.1/pak_0.2.0.9000.tgz'
Content type 'application/octet-stream' length 7638385 bytes (7.3 MB)
==================================================
downloaded 7.3 MB


The downloaded binary packages are in
	/var/folders/cw/805_99kx0lq50gkr0hr81_y40000gp/T//RtmpaNcxHm/downloaded_packages
✖ Creating lockfile pkg.lock [587ms]

Error: <callr_remote_error: Cannot install packages:
* roxygen2: dependencies must be TRUE, FALSE, NA or a list of dependency types>
 in process 83165
-->
<simpleError: Cannot install packages:
* roxygen2: dependencies must be TRUE, FALSE, NA or a list of dependency types>

 Stack trace:

 12. (function (...)  ...
 13. base:::withCallingHandlers(cli_message = function(msg) { ...
 14. get("lockfile_create_internal", asNamespace("pak"))(...)
 15. prop$stop_for_solution_error()
 16. private$plan$stop_for_solve_error()
 17. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
 18. base:::stop("Cannot install packages:\n", msg, call. = FALSE)
 19. base:::.handleSimpleError(function (e)  ...
 20. h(simpleError(msg, call))
 21. base:::stop(e)
 22. (function (e)  ...

 x Cannot install packages:
* roxygen2: dependencies must be TRUE, FALSE, NA or a list of dependency types

Warning message:
partial match of 'topenv' to 'topenvs'
Execution halted

The following two work:

R -q -e 'pak::lockfile_create("any::roxygen2", dependencies = c("Config/Needs/check"))'
> pak::lockfile_create("any::roxygen2", dependencies = c("Config/Needs/check"))
✔ Updated metadata database: 4.38 MB in 8 files.
ℹ R 4.1 aarch64-apple-darwin20 packages are missing from Bioconductor
✔ Updating metadata database ... done
✔ Created lockfile pkg.lock [11s]
>
>
R -q -e 'pak::lockfile_create("roxygen2")'
> pak::lockfile_create("roxygen2")
✔ Loading metadata database ... done
✔ Created lockfile pkg.lock [1.7s]
>
>

krlmlr avatar Dec 19 '21 08:12 krlmlr

For Config/Needs/check you need to use a local package, i.e. local::... or deps::... because otherwise we don't know the Config/Needs fields, they are not in the CRAN metadata.

gaborcsardi avatar Dec 19 '21 12:12 gaborcsardi

Thanks. This also occurs in DBI which has the relevant Config/Needs/check field: https://github.com/r-dbi/DBI/blob/main/DESCRIPTION#L43. I wonder why adding any:: to roxygen2 seems to resolve the problem, also on GitHub Actions for DBI.

krlmlr avatar Dec 19 '21 22:12 krlmlr

It is a bug that is accidentally suppressed, I think. Nevertheless Config/... dependency specifications should be ignored for CRAN packages.

gaborcsardi avatar Dec 19 '21 23:12 gaborcsardi