r-lib / pak

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

Function to upgrade world #639

Open latot opened 3 weeks ago

latot commented 3 weeks ago

Hi, pak is working very well rn, I think would be great to have a function to upgrade all libraries, the actual pak::pkg_install also only supports one package at a time, rn the only workaround I found is iterate over all the packages and run pak to install/upgrade them.

Thx!

gaborcsardi commented 3 weeks ago

the actual pak::pkg_install also only supports one package at a time

I don't think that's true:

pak::pkg_install(c("filelock", "nanoparquet"), lib = tempfile())

works fine.

We'll have a lib_upgrade() function to upgrade all packages, eventually: https://github.com/r-lib/pak/issues/168

latot commented 3 weeks ago

Weird! here an example of a vector that does not works.

pak::pkg_install(pak::lib_status()$package)
Error: 
! error in pak subprocess
Caused by error in `asNamespace("pak")$lib_status_internal(...)`:
! unused arguments (pkg = c("ape", "askpass", "backports", "base64enc", "BH", "bit", "bit64", "blob", "boot", "brew", "brio", "bslib", "bugs", "cachem", "callr", "cellranger"..............................

Type .Last.error to see the more details.

Also the tempfile() case return File or folder does not exists.

gaborcsardi commented 3 weeks ago

That's a lazy evaluation mishap, use

pkgs <- pak::lib_status()$package
pak::pkg_install(pkgs)

But of course this will fail as soon as you have a package installed that is not available from CRAN. It'll also replace your non-CRAN installs with CRAN packages.

latot commented 3 weeks ago

no idea which part is a lazy evalualtion... seems some parts there are not that intuitive, but still was just a trick to try upgrade all.

Maybe is just better to wait for the function to upgrade the system.

Also, I have installed some packages that are not in CRAN, and running pkg_install does not fails with them, is that right?