r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
668 stars 60 forks source link

Failed to install from source #650

Open latot opened 3 months ago

latot commented 3 months ago

Hi, I was trying to install a package from source, but there was an unexpected error.

docker run --rm -ti rocker/geospatial R
install.packages("pak")
pak::pkg_install("https://github.com/r-lib/pak")
unloadNamespace("pak")
pak::pkg_install("sf?source")
✔ Loading metadata database ... done

Error: 
! error in pak subprocess
Caused by error in `` `$<-.data.frame`(`*tmp*`, "current", value = 0L) ``:
! replacement has 1 row, data has 0
Type .Last.error to see the more details.
There were 11 warnings (use warnings() to see them)
> .Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error: 
! error in pak subprocess
Caused by error in `` `$<-.data.frame`(`*tmp*`, "current", value = 0L) ``:
! replacement has 1 row, data has 0
---
Backtrace:
1. pak::pkg_install("sf?source")
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$download()
 4. private$plan$download_solution()
 5. pkgdepends:::pkgplan_download_solution(self, private)
 6. pkgdepends:::synchronise(self$async_download_solution())
 7. asNamespace("pkgcache")$synchronise(...)
 8. self$async_download_solution()
 9. pkgdepends:::pkgplan_async_download_solution(self, private)
10. pkgdepends:::pkgplan_async_download_internal(self, private, private$solution$result$data, …
11. private$create_progress_bar(what)
12. pkgdepends:::pkgplan__create_progress_bar(what)
13. `$<-`(`*tmp*`, "current", value = 0L)
14. `$<-.data.frame`(`*tmp*`, "current", value = 0L)
15. base::stop(sprintf(ngettext(N, "replacement has %d row, data has %d", …
16. | base::.handleSimpleError(function (e) …
17. global h(simpleError(msg, call))

Traceback

4: base::stop(cond)
3: err$throw(res$error)
2: remote(function(...) get("pkg_install_do_plan", asNamespace("pak"))(...), 
       list(proposal = NULL))
1: pak::pkg_install("sf?source")

Note/Edit, seems the error changes if you run pak::pkg_install("lwgeom?source") before try to install sf.

Thx!

gaborcsardi commented 3 months ago

You cannot use pak to install itself. If you want to install the dev version, you can install a nightly build from https://pak.r-lib.org/reference/install.html#nightly-builds

latot commented 3 months ago

There is no error installing pak, it works fine, the problem is after that.

latot commented 3 months ago

tested using what you described, the error persist.

gaborcsardi commented 3 months ago

This container has

> getOption("repos")
                                         CRAN
"https://p3m.dev/cran/__linux__/jammy/latest"

so there are no source packages available. You need to add another repo that has source packages.

latot commented 3 months ago

I agree, I'll not say it should works if there is no more repos. But should be a clear stop and message instead the current error.