`pak::local_install_deps` fails to download in a GitHub CodeSpaces postCreateCommand

Open
#853 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
github, r
Domain
cloud, devops, tooling

Research direction

Start with the supplied .devcontainer/devcontainer.json and reproduce the postCreateCommand using R -e "pak::local_install_deps()" in GitHub Codespaces. Compare it with the reported working pak::pkg_install path; done means local_install_deps successfully downloads and installs the listed dependencies in that environment.

Written by the indexing model from the issue text.

Description

I am not sure why, but pak::local_install_deps always fails to download when run inside a GitHub CodeSpaces postCreateCommand, whereas a plain pak::pkg_install works fine.

To reproduce, create an R library with at least one dependency, and a .devcontainer/devcontainer.json that looks like this:

{
  "name": "R Development",
  "image": "mcr.microsoft.com/devcontainers/base:debian",
  "features": {
    "ghcr.io/rocker-org/devcontainer-features/r-rig:1": {
      "version": "release",
      "installREnv": false,
      "installRMarkdown": false,
      "installJupyterlab": false
    }
  },
  "postCreateCommand": "R -e \"pak::local_install_deps()\""
}

(Note: depending what dependencies you're trying to install, you might also want to install some system packages, like: sudo apt-get update && sudo apt-get install -y libxml2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgit2-dev libharfbuzz-dev libjpeg-dev libpng-dev libtiff-dev libwebp-dev libx11-dev libcairo2-dev cmake pandoc)

Here is an example traceback:

Will install 9 packages.
Will download 9 CRAN packages (6.71 MB), cached: 1 (0 B).

  • arrow 23.0.1.1 [bld][cmp][dl] (4.37 MB) + v cmake, v libcurl4-openssl-dev, v libssl-dev
  • assertthat 0.2.1 [bld][dl] (12.74 kB)
  • bit 4.6.0 [bld][cmp][dl] (304.58 kB)
  • bit64 4.6.0-1 [bld][cmp][dl] (142.04 kB)
  • dplyr 1.2.0 [bld][cmp][dl] (922.39 kB)
  • econdatasets 0.1.0 [bld][dl] (7.38 kB)
  • generics 0.1.4 [bld][dl] (47.22 kB)
  • tidyr 1.3.2 [bld][cmp][dl] (809.03 kB)
  • tidyselect 1.2.1 [bld][cmp][dl] (103.59 kB)
    v All system requirements are already installed.

i Getting 9 pkgs (6.71 MB)
x Failed to download arrow 23.0.1.1 (source)
x Failed to download assertthat 0.2.1 (source)
x Failed to download bit 4.6.0 (source)
x Failed to download bit64 4.6.0-1 (source)
x Failed to download dplyr 1.2.0 (source)
x Failed to download econdatasets 0.1.0 (source)
x Failed to download generics 0.1.4 (source)
x Failed to download tidyr 1.3.2 (source)
x Failed to download tidyselect 1.2.1 (source)
Error:
! error in pak subprocess
Caused by error:
! Failed to download arrow from https://cloud.r-project.org/src/contrib/arrow_23.0.1.1.tar.gz and https://cloud.r-project.org/src/contrib/Archive/arrow/arrow_23.0.1.1.tar.gz.
Failed to download assertthat from https://cloud.r-project.org/src/contrib/assertthat_0.2.1.tar.gz and https://cloud.r-project.org/src/contrib/Archive/assertthat/assertthat_0.2.1.tar.gz.
Failed to download bit from https://cloud.r-project.org/src/contrib/bit_4.6.0.tar.gz and https://cloud.r-project.org/src/contrib/Archive/bit/bit_4.6.0.tar.gz.
Failed to download bit64 from https://cloud.r-project.org/src/contrib/bit64_4.6.0-1.tar.gz and https://cloud.r-project.org/src/contrib/Archive/bit64/bit64_4.6.0-1.tar.gz.
Failed to download dplyr from https://cloud.r-project.org/src/contrib/dplyr_1.2.0.tar.gz and https://cloud.r-project.org/src/contrib/Archive/dplyr/dplyr_1.2.0.tar.gz.
Failed to download econdatasets from https://cloud.r-project.org/src/contrib/econdatasets_0.1.0.tar.gz and https://cloud.r-project.org/src/contrib/Archive/econdatasets/econdatasets_0.1.0.tar.gz.
Failed to download generics from https://cloud.r-project.org/src/contrib/generics_0.1.4.tar.gz and https://cloud.r-project.org/src/contrib/Archive/generics/generics_0.1.4.tar.gz.
Failed to download tidyr from https://cloud.r-project.org/src/contrib/tidyr_1.3.2.tar.gz and https://cloud.r-project.org/src/contrib/Archive/tidyr/tidyr_1.3.2.tar.gz.
Failed to download tidyselect from https://cloud.r-project.org/src/contrib/tidyselect_1.2.1.tar.gz and https://cloud.r-project.org/src/contrib/Archive/tidyselect/tidyselect_1.2.1.tar.gz.

Backtrace:

  1. pak::local_install_deps()
  2. pak:::remote(function(...) get("pkg_install_do_plan", asNamespace("pak"))(...)...
  3. err$throw(res$error)

Subprocess backtrace:

  1. base::withCallingHandlers(cli_message = function(msg) { ...
  2. get("pkg_install_do_plan", asNamespace("pak"))(...)
  3. proposal$stop_for_download_error()
  4. private$plan$stop_for_solution_download_error()
  5. pkgdepends:::pkgplan_stop_for_solution_download_error(self, private)
  6. pkgdepends:::stop(err)
  7. | base::throw(add_class(args[[1]], c("rlib_error_3_0", "rlib_error"), ...
  8. | base::signalCondition(cond)
  9. global (function (e) ...
    Execution halted
Dominant language
C
Stars
821
Forks
88
Avg merge
17m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/pak

All issues in r-lib/pak

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.