Support `install.R` files
See original GitHub issueWe should support R functionality. R handles dependencies differently from both Python and Julia, here are some thoughts from Carl:
Current proposal
- Use
runtime.txt
to specify the R version as a date.- We’ll expect a line with the format
r-YYYY-MM-DD
. E.g.2017-01-21
. - If that line is found, it will trigger and R build in r2d. This sets up a version of R that was current at that date, and sets the MRAN snapshot for that date as the default repo.
- We’ll also set up an R kernel for jupyter to discover. This R will also make sure we are installing in a user-owned library path so stuff can be installed there at any point.
- We’ll expect a line with the format
- Use
install.R
(must be executable) to execute with the installed R kernel (in the point above). This primarily lets people write R code that installs packages. - If
install.R
is given without ar-YYYY-MM-DD
line inruntime.txt
then we raise an error.
Main to-do items
- How do users specify what servers contain what packages (e.g. rstudio vs. bioconductor)
- ~What about non-CRAN packages?~ outside of the standard R repositories, we can’t do much else other then tell people to clone a github repo of preference and install it with
install.R
orpostBuild
or something. - How can we ensure versions are frozen, since R doesn’t easily handle specific version installs?
- Someone needs to actually implement this!
Notes
In an R package, the DESCRIPTION file plays the role of a
requirements.txt
in stating the dependencies, minimal version needed, and where get them (e.g. CRAN or additional cran-type repo like bioconductor).This approach does not accommodate installing something that is not the most recent version of a package. (CRAN archives old sources, but because, unlike python or ruby gems distribution, CRAN is designed to provide binaries & you can’t guarantee binaries build for an old /archived source, the default install does not immediately support installing archived packages).
If you just have a list of packages you want, I recommend something along the lines of what we do with rocker, e.g.
install2.r
cat deps.txt
Where deps.txt is just a list of package names you want to install. If these come from multiple repos (cran & bioconductor), just list those as arguments to -r:
install2.r -r “https://cran.rstudio.com” -r “https://bioconductor.org/pagkages/release”
cat deps.txt
If you want to install the same version each time, just use an MRAN snapshot of the appropriate date.
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (7 by maintainers)
Top GitHub Comments
Me and @cboettig just talked about this!
r-2017-01-21
needs to be set there to ‘trigger’ R. This sets up a version of R that was current at that date, and sets the MRAN snapshot for that date as the default repo. We’ll also set up R kernel for jupyter to discover. This R will also make sure we are installing in a user-owned library path so stuff can be installed there at any point.install.r
executable script, that is then executed with the installed R. This lets people write R code that installs packages. This seems to be the most common & accepted way to install libraries.We can deal with packrat later. This current solution seems like a good start to supporting the R community on binder/repo2docker.
I think that we should pivot this issue to be specifically about adding an R build pack (e.g. supporting
install.R
or something like this). Will change title to reflect this!