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

Installing subdirectory packages from github fails with pak and : notation #2011

Open
jashapiro opened this issue Oct 10, 2024 · 1 comment

Comments

@jashapiro
Copy link

When using renv::install() with options(renv.config.pak.enabled = TRUE) and a package that is nested within a GitHub subdirectory, the package fails to install.

I created a very small test repo to demonstrate this issue, which can be demonstrated with the following code:

options(renv.config.pak.enabled = TRUE)
renv::install("jashapiro/nestedpak:mypak")

This yields the following error/backtrace:

Error: 
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* jashapiro/nestedpak:mypak: ! pkgdepends resolution error for jashapiro/nestedpak:mypak.
Caused by error: 
! Can't find GitHub repo jashapiro/nestedpak:mypak.
---
Backtrace:
1. renv::install("jashapiro/nestedpak:mypak")
2. renv:::renv_pak_install(packages = packages, library = libpaths, type = type, …
3. pak$pkg_install(pkg = packages, lib = lib, ask = prompt, upgrade = TRUE)
4. pak:::remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...), …
5. err$throw(res$error)
---
Subprocess backtrace:
1. base::withCallingHandlers(cli_message = function(msg) { …
2. get("pkg_install_make_plan", asNamespace("pak"))(...)
3. prop$stop_for_solution_error()
4. private$plan$stop_for_solve_error()
5. pkgdepends:::pkgplan_stop_for_solve_error(self, private)
6. base::throw(new_error("Could not solve package dependencies:\n", msg, …
7. | base::signalCondition(cond)
8. global (function (e) …

The following code does work as expected:

options(renv.config.pak.enabled = FALSE)
renv::install("jashapiro/nestedpak:mypak")

as does:

pak::pak("mypak=jashapiro/nestedpak/mypak")

While the renv documentation says that subdirectories in git repositories should be separated by :, I did note that using a / as below does also work:

options(renv.config.pak.enabled = TRUE)
renv::install("jashapiro/nestedpak/mypak")
─ Session info ──────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.1 (2024-06-14)
 os       macOS 15.0
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/New_York
 date     2024-10-10
 rstudio  2024.09.0+375 Cranberry Hibiscus (desktop)
 pandoc   3.4 @ /Users/josh/.pixi/bin/pandoc

─ Packages ──────────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cli           3.6.2   2023-12-11 [1] CRAN (R 4.4.0)
 gitcreds      0.1.2   2022-09-08 [1] CRAN (R 4.4.0)
 pak           0.8.0   2024-08-26 [1] CRAN (R 4.4.1)
 renv          1.0.10  2024-10-05 [1] CRAN (R 4.4.1)
 rstudioapi    0.16.0  2024-03-24 [1] CRAN (R 4.4.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.4.0)
@kevinushey
Copy link
Collaborator

Thanks! I've made a change in renv that should improve the situation here, and have also asked the pak maintainer whether the renv-style remote declaration here could also be supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants