rstudio / renv

renv: Project environments for R.
https://rstudio.github.io/renv/
MIT License
1.02k stars 155 forks source link

renv::restore() based on how packages were installed #1984

Open shriv opened 2 months ago

shriv commented 2 months ago

Kia ora, I have projects where I run R in a nix environment (on MacOS 14.6.1 AMD64) but manage my packages with renv. I only recently learned that not all R installations are equal and the one that I have via nix prevents binary installations. I followed the following hack to enable them again. Rebuilds are so much faster now thank you! :-)

When a colleague wants to restore the same library on their laptop with the same OS and arch, renv::restore() will install the binaries if available. Unfortunately, some packages like sf, KernSmooth, classInt and Rcpp need to be installed from source because they don't link correctly to the dylib libraries if installed from binaries (this is an nix issue / feature? that I will raise separately).

Currently, I need to exclude the above packages in the first restore, change pkgType to source, restore again and revert the pkgType option. Is there a simple of getting renv to record how a package was installed (in the snapshot) and then following that installation in the restore? Any suggestions / thoughts will be much appreciated :-)

R version 4.4.1 (2024-06-14)
Platform: aarch64-apple-darwin23.6.0
Running under: macOS Sonoma 14.6.1
kevinushey commented 2 months ago

Thanks -- this isn't currently available in renv, but we could evaluate supporting this in the future.