Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve use of install.packages() #20

Closed
wants to merge 1 commit into from
Closed

Improve use of install.packages() #20

wants to merge 1 commit into from

Conversation

coatless
Copy link

@coatless coatless commented Oct 2, 2018

  • From 5 install commands down to 1 by listing packages in pkgs variable.
  • Use ncores to parallelize compiles as each package is installed from source.

- From 5 install commands down to 1 by listing packages in `pkgs` variable.
- Use ncores to parallelize compiles as each package is installed from source.
@choldgraf
Copy link
Contributor

Thanks for the improvements! One note (maybe @minrk can confirm) is that I think increasing the number of cores won't make a difference on mybinder.org since users only get 50% of a single CPU. If we confirm this, could you write in a comment to this effect just so users aren't confused if it still takes a while to build.

On that note, if you have any idea for how we can avoid building from source on linux, I'd love to hear it :-)

@coatless
Copy link
Author

coatless commented Oct 2, 2018

@choldgraf as the image is using rocker/tidyverse:3.5.1, which in turn is built off of debian:stretch. You could use apt-get r-cran-<pkgname>.

For example, ggplot2 could be installed with:

apt-get update && apt-get install -y r-cran-ggplot2

c.f. https://cran.r-project.org/bin/linux/debian/#administration-and-maintenance
http://dirk.eddelbuettel.com/blog/2017/12/13/#013_faster_package_installation_two

@cboettig
Copy link
Collaborator

cboettig commented Oct 2, 2018

@coatless Actually it's probably not a good idea to install r-cran-* packages on the rocker/tidyverse image. Those debian binaries will depend on r-base debian binary, and so install another, older version of R on your image. See https://github.com/rocker-org/rocker-versioned/#notes. Definitely preferable to use install.packages() in this context, though I realize it does increase the compile time.

If you're using rocker/tidyverse, ggplot2 & rest of tidyverse, httr & rmarkdown will already be installed; though perhaps you're referring rather to the generic question of installing packages. I'm not sure what the best solution is there; but it may help to use a FROM image in the Dockerfile that simply has more common dependencies pre-installed -- that's why rocker/binder builds on rocker/geospatial, for instance.

@choldgraf
Copy link
Contributor

@cboettig thanks for the thoughts! We've also been discussing this topic over in jupyterhub/repo2docker#412 ... we hadn't realized that were no binaries built for the linux world. It seems that some people are actually just using the anaconda distribution w/ the conda-forge repository to install R packages, which seems like a hacky-but-workable solution for linux. Seems like there are lots of sub-optimal solutions out there but nothing that's obviously the way to go :-/

@eddelbuettel
Copy link

eddelbuettel commented Oct 2, 2018

we hadn't realized that were no binaries built for the linux world

Incorrect as stated. Ie the Rutter PPAs mentioned on the CRAN README have ~ 3000 of the 13000 CRAN packages as binaries. Of course, those are current as opposed to snapshotted a la MRAN, but saying "oh, linux has no binaries, let's just switch to anaconda" is not entirely correct in its reasoning.

@coatless
Copy link
Author

coatless commented Oct 2, 2018

@coatless Actually it's probably not a good idea to install r-cran-* packages on the rocker/tidyverse image. Those debian binaries will depend on r-base debian binary, and so install another, older version of R on your image. See https://github.com/rocker-org/rocker-versioned/#notes. Definitely preferable to use install.packages() in this context, though I realize it does increase the compile time.

Ewk! I missed that portion. Thanks for pointing that out @cboettig.

@betatim betatim closed this May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants