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

Installation of older packages versions not possible in rocker/r-ver:3.6.2 #204

Closed krystian8207 closed 2 years ago

krystian8207 commented 4 years ago

Trying to install older versions of packages fails.

Please see:

docker run -it rocker/r-ver:3.6.2 bash -c "R -e \"install.packages('remotes', quiet = TRUE); remotes::install_version('shiny', '1.4.0', repos = 'https://cloud.r-project.org')\""

Result:

R version 3.6.2 (2019-12-12) -- "Dark and Stormy Night"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages('remotes', quiet = TRUE); remotes::install_version('shiny', '1.4.0.1', repos = 'https://cloud.r-project.org')
Error in package_find_repo(package, repos) : 
  couldn't find package 'shiny'
Calls: <Anonymous> -> download_version_url -> package_find_repo
Execution halted

Installation of shiny 1.4.0.2 (the latest one) works fine.

For older R version images (like rocker/r-ver:3.6.1) the above code works fine as well.

cboettig commented 4 years ago

Try now?

krystian8207 commented 4 years ago

@cboettig I tried both with rocker/r-ver:3.6.2 and rocker/r-ver:latest but the problem still exists.

➜  ~ docker images rocker/r-ver 
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
rocker/r-ver        3.6.2               a1ac6d9d1ee0        6 days ago          656MB
rocker/r-ver        latest              eb4593feb287        8 days ago          656MB
cboettig commented 4 years ago

@krystian8207 thanks for the follow up, yes I can reproduce the error in 3.6.2 but not in other images (e.g. 3.6.3, 3.6.1). Haven't had a chance to dig deeper into why though, that's very strange as there is little difference other than the default version with 3.6.2.

As an aside, while install_version should work, you do know that rocker is already locking versions by default using the MRAN mirrors? (In general that should be more robust than install_version(), if less flexible, since install_version() can often result in bringing in more recent versions of dependencies that may not be compatible with the requested version (i.e. combinations that were never concurrent on CRAN).

Pit-Storm commented 4 years ago

@krystian8207 Check at shiny package release history in whicht time your shiny version had been available at cran. Then write down the last availability date. Run the following command in your Dockerfile before installing the package: RUN echo "options(repos = c(CRAN = 'https://mran.microsoft.com/snapshot/<YYYY-MM-DD>'), download.file.method = 'libcurl')" > /usr/local/lib/R/etc/Rprofile.site

Be shure that you replaced <YYYY-MM-DD> with the date you wrote down before.

You can also run the command when starting an container additionally to the install.packae command.

krystian8207 commented 4 years ago

@cboettig @Pit-Storm thank you for this solution, but this is workaround. In my development workflow I take care of package versions with using renv package on top CRAN repository, so using mran snapshots makes this workflow very limited.

eitsupi commented 2 years ago

If you want to install any version with renv, you may need to rewrite the repository settings as above. https://www.rocker-project.org/use/extending/