r-lib / pak

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

Make installation easier with Homebrew R (or other builds from sources) #497

Closed kevinushey closed 8 months ago

kevinushey commented 1 year ago

pak binaries are not provided for Homebrew R, so users with Homebrew R need to install pak from sources. But this is currently challenging.

Creating private library

The installation log asks the user to run pak:::create_dev_lib(), but that's easy to miss.

> remotes::install_github("r-lib/pak", force = TRUE)
Downloading GitHub repo r-lib/pak@HEAD
Running `R CMD build`...
* checking for file ‘/private/var/folders/9n/3nxsgkrj0rlfx196kzdttpww0000gn/T/RtmpBBhghx/remotes14ae16d54cf30/r-lib-pak-f26bb0c/DESCRIPTION’ ... OK
* preparing ‘pak’:
* checking DESCRIPTION meta-information ... OK
* running ‘cleanup’
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘pak_0.5.1.9000.tar.gz’
Installing package into '/Users/kevin/Library/R/homebrew/aarch64/4.3/library'
(as 'lib' is unspecified)
* installing *source* package ‘pak’ ...
** using staged installation
*** Running ./configure
** R
** data
*** moving datasets to lazyload DB
**** not bundling dependency data (call pak:::create_dev_lib())
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (pak)

Should pak::pkg_install() notify that the private library isn't initialized?

> pak::pkg_install()
Error in load_private_package("glue") :
  Cannot load glue from the private library

It'd be nice if pak could detect and prompt to run pak:::create_dev_lib() here.

pak:::create_dev_lib() fails if required packages are unavailable

> pak:::create_dev_lib()
Error in find_lib(pkg) : Required package `callr` is not available

This feels like a chicken-and-egg problem: pak needs packages to bootstrap its private library, but (ideally) we'd be able to use pak to install those packages. So we're kind of stuck using install.packages() to install all of these packages in the end? What packages do we need?

gaborcsardi commented 1 year ago

This only happens for dev versions that depend on GitHub packages. So install.packages is not enough there.

gaborcsardi commented 8 months ago

This is a rare issue, and it is hard to solve it properly, so I am going to close it.