Closed lgaborini closed 1 year ago
What's the output of traceback()
right after the error?
Downloading git repo https://github.com/rstudio/bookdown.git
Error: Failed to install 'bookdown' from Git:
cannot open the connection
> traceback()
9: stop(remote_install_error(remotes[[i]], e))
8: value[[3L]](cond)
7: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
5: tryCatch(res[[i]] <- install_remote(remotes[[i]], ...), error = function(e) {
stop(remote_install_error(remotes[[i]], e))
})
4: install_remotes(remotes, credentials = credentials, dependencies = dependencies,
upgrade = upgrade, force = force, quiet = quiet, build = build,
build_opts = build_opts, build_manual = build_manual, build_vignettes = build_vignettes,
repos = repos, type = type, ...)
3: remotes::install_git("https://github.com/rstudio/bookdown.git",
force = TRUE) at #3
2: force(code)
1: withr::with_options(list(repos = repos_drat), {
remotes::install_git("https://github.com/rstudio/bookdown.git",
force = TRUE)
})
And here is a Docker for the reprex.
This is coming from available.packages()
/ install.packages()
, so we cannot fix it in remotes:
❯ options(repos = c(drat = "file:///drat"))
❯ av <- install.packages("cli")
Installing package into ‘/Users/gaborcsardi/Library/R/arm64/4.2/library’
(as ‘lib’ is unspecified)
Error in read.dcf(file = tmpf) : cannot open the connection
In addition: Warning message:
In read.dcf(file = tmpf) :
cannot open compressed file '/drat/src/contrib/PACKAGES', probable reason 'No such file or directory'
I have lost hours to debug this!
In my setup I have a local package repository, such as the ones created by {drat}, that is added on startup to the
options()$repos
entry.According to the docs, local repositories must start with
file:
.If the local repository actually exists, {remotes} installs packages without issues, from CRAN, git or any other valid source.
If the local repository is not available (e.g. the script is running inside a Docker container, but the repository is an unmounted volume), the error message is extremely unhelpful, and leads you thinking that the issue affects the package you are trying to install, or its installation method (e.g. a privately hosted Git repo requiring authentication).
Created on 2022-09-08 with reprex v2.0.2
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.0 (2022-04-22 ucrt) #> os Windows 10 x64 (build 19044) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_Switzerland.utf8 #> ctype English_Switzerland.utf8 #> tz Europe/Berlin #> date 2022-09-08 #> pandoc 2.18 @ C:/Users/LorenzoGaborini/apps_offline/RStudioPreview/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0) #> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0) #> evaluate 0.16 2022-08-09 [1] CRAN (R 4.2.1) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) #> git2r 0.30.1 2022-03-16 [1] CRAN (R 4.2.0) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) #> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0) #> htmltools 0.5.3 2022-07-18 [1] CRAN (R 4.2.1) #> knitr 1.40 2022-08-24 [1] CRAN (R 4.2.1) #> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) #> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.2.1) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.2.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.2.0) #> R.utils 2.12.0 2022-06-28 [1] CRAN (R 4.2.1) #> remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.0) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.1) #> rlang 1.0.4 2022-07-12 [1] CRAN (R 4.2.1) #> rmarkdown 2.16 2022-08-24 [1] CRAN (R 4.2.1) #> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) #> stringi 1.7.8 2022-07-11 [1] CRAN (R 4.2.1) #> stringr 1.4.1.9000 2022-09-08 [1] git2r (https://github.com/hadley/stringr.git@792bc92) #> styler 1.7.0 2022-03-13 [1] CRAN (R 4.2.0) #> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) #> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0) #> xfun 0.32 2022-08-10 [1] CRAN (R 4.2.1) #> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0) #> #> [1] C:/Users/LorenzoGaborini/R/R-4.2.0/library #> #> ────────────────────────────────────────────────────────────────────────────── ```There are no issues if the
drat
repository is not added to the list, or it points to a non-file:
URI. It does not even need to exist: in this case the warning is explicit but not blocking (disregard the {rlang} error, the package should install fine).Created on 2022-09-08 with reprex v2.0.2
Thanks!