rocker-org / rocker-versioned

Run current & prior versions of R using docker
https://hub.docker.com/r/rocker/r-ver
GNU General Public License v2.0
297 stars 169 forks source link

install.packages doesn't work with default settings with r-ver:3.1.0 #14

Closed jackwasey closed 7 years ago

jackwasey commented 7 years ago

It seems that the default repo uses MRAN. This stops even docopt working which some of the littler seem to rely on.

It seems I can simply use: install.packages("docopt", repos = "http://cran.rstudio.com")

(not https for that R version!)

The default error message from R (no blame being apportioned here) simply says that the requested package is not available for R 3.1.0, which is not true in general, just true for the default MRAN repo.

I am not capable of quickly telling with MRAN is screwed up, whether the current behavior is intended (simulating a time warp, rather than simply an old version of R), or whether I have a local configuration problem. I did just pull the rocker/r-ver:3.1.0 image, so I think the latter is less likely.

Thanks for making this valuable image available. Many institutions seem stuck on ancient versions of R, and this is pretty much the only way I will be able to support them using my packages, and accurately write R >= 3.1.0 in my DESCRIPTION

cboettig commented 7 years ago

r-ver:3.1.0 is failing to install docopt from MRAN because the MRAN url is also https, if you switch it to http manually it will install fine, just as it does from current CRAN. (Note that I believe while docopt is that first MRAN snapshot, littler wasn't yet on CRAN so you'll have to grab it from current CRAN or a later snapshot. Some of littler may also need a more recent version of docopt than the 2014; e.g. if specifying multiple repos on install2.r)

Anyway, since https support wasn't automatically included in R builds in 3.1.0, I guess I should patch that image to enable https.

cboettig commented 7 years ago

Okay, 3.1.0 and 3.2.0 should now support https urls out-of-the box (by setting the option download.file.method=curl and providing curl, since libcurl isn't an option in these images). This means you can install docopt or any package that was on CRAN at the time those versions were current just by using install.packages (modulo installing any system dependencies with apt-get of course).

However, note that the default behavior of these older images is still to install packages from the MRAN archive; if you just want to test that your package still works with older R versions you'll still want to set something like options(repos="https://cran.rstudio.com") in a local.Rprofile` or something to make sure you are testing against the most recent version of any package dependencies.

Thanks for the kind words though, glad it is helpful. If necessary you should be able to build even earlier versions of R using these same Dockerfiles, e.g. docker build --build-arg R_VERSION=2.15.0 -t r-ver:2.15.0 Dockerfile. There's no MRAN snapshots available for these older versions, though that doesn't matter for your use case. (Other users could do something more complicated to install older versions of R packages from CRAN archive pages).

jackwasey commented 7 years ago

And there was me assuming the worst of Microsoft... Just a minor note: I was referring to Debian's longer-established littler, not the CRAN version. Thanks again.

eddelbuettel commented 7 years ago

I am coming to this late, but the version of littler should be the same. Same author, same repo, same everything, ... apart from the fact that the distro releases at Debian but keep you at older versions. But then we usually overcome this here.

cboettig commented 7 years ago

Sounds like we're resolved so closing, but re-open if you have other suggestions.

Note that because we build R from source on r-ver, this means the Debian package r-base-core is not installed. Dirk can correct me but I'm not sure you can install r-cran-littler or other deb versions of r packages without pulling in the binary r-base-core, which means you'll have two versions of R and have to take some care to see you are using the one you intended