containerit icon indicating copy to clipboard operation
containerit copied to clipboard

Install binary if available

Open nuest opened this issue 6 years ago • 5 comments

Fun and educational post: http://dirk.eddelbuettel.com/blog/2017/12/13/#013_faster_package_installation_two

Installation time is not really an issue for it, it would be cool if we could detect if a binary package is available and then install that.

@eddelbuettel: Is it possible to get the information whether an R package is available as a Debian binary from somewhere? Maybe some clever apt cache search?

nuest avatar Dec 21 '17 09:12 nuest

@nuest Yes, planned as the next blog post. Didn't get to it yet :)

eddelbuettel avatar Dec 21 '17 11:12 eddelbuettel

Here is a short write up. Let me know if it is helpful and/or comprehensible: http://dirk.eddelbuettel.com/blog/2017/12/22#014_finding_binary_deb_packages

eddelbuettel avatar Dec 22 '17 23:12 eddelbuettel

Yes, that helps:

library("sf")
library("RcppAPT")

pkgs <- names(sapply(c(sessionInfo()$otherPks, sessionInfo()$loadedOnly), function(p) p$package)) # probably a better way to do this... just a quick hack
pkgs <- tolower(paste("r-cran-", pkgs, sep = ""))

RcppAPT::hasPackages(pkgs)

gives me

r-cran-compiler r-cran-magrittr    r-cran-class    r-cran-tools      r-cran-dbi 
          FALSE            TRUE            TRUE           FALSE            TRUE 
   r-cran-units     r-cran-rcpp r-cran-udunits2     r-cran-grid    r-cran-e1071 
          FALSE            TRUE           FALSE           FALSE            TRUE 
r-cran-classint    r-cran-tcltk 
          FALSE           FALSE

which is just what I need.

Using binary might be worse for reproducibility, but I still like this as a feature for containerit.

nuest avatar Dec 23 '17 13:12 nuest

I am also a little undecided about wheter it is better for reproducability. On the one hand it "fixes" one more moving part: rebuilding a container gets you more things that are unchanged. But the container builder may have a little bit less control over the binaries -- just like with a distro.

eddelbuettel avatar Dec 23 '17 13:12 eddelbuettel

Yes, that helps:

library("sf")
library("RcppAPT")

pkgs <- names(sapply(c(sessionInfo()$otherPks, sessionInfo()$loadedOnly), function(p) p$package)) # probably a better way to do this... just a quick hack
pkgs <- tolower(paste("r-cran-", pkgs, sep = ""))

RcppAPT::hasPackages(pkgs)

gives me

r-cran-compiler r-cran-magrittr    r-cran-class    r-cran-tools      r-cran-dbi 
          FALSE            TRUE            TRUE           FALSE            TRUE 
   r-cran-units     r-cran-rcpp r-cran-udunits2     r-cran-grid    r-cran-e1071 
          FALSE            TRUE           FALSE           FALSE            TRUE 
r-cran-classint    r-cran-tcltk 
          FALSE           FALSE

which is just what I need.

Using binary might be worse for reproducibility, but I still like this as a feature for containerit.

nuest avatar Dec 26 '17 14:12 nuest