-
Notifications
You must be signed in to change notification settings - Fork 0
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
clean up renv usage to fix incompatibility between stored CRAN repositories and renv version. update README.md files. regenerate renv.lock files #29
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||||||
FROM rocker/r-ver:4.3.2 | ||||||||||
FROM rocker/r-ver:4.4.1 | ||||||||||
|
||||||||||
# install general OS utilities | ||||||||||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||||||
|
@@ -76,7 +76,8 @@ RUN pip3 install -r requirements.txt | |||||||||
# install required R packages using renv | ||||||||||
COPY "${MODEL_DIR}/renv.lock" ./ | ||||||||||
ENV RENV_PATHS_LIBRARY="renv/library" | ||||||||||
RUN Rscript -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))" | ||||||||||
RUN /rocker_scripts/setup_R.sh https://p3m.dev/cran/__linux__/jammy/2025-02-05 | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding comments for reference
Suggested change
|
||||||||||
RUN Rscript -e "install.packages('renv')" | ||||||||||
RUN Rscript -e "renv::restore()" | ||||||||||
|
||||||||||
# clone https://github.com/reichlab/container-utils. ADD is a hack ala https://stackoverflow.com/questions/35134713/disable-cache-for-specific-run-commands | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -77,18 +77,34 @@ Generating this file is somewhat Python tooling-specific. For example, [pipenv]( | |||||
|
||||||
A `renv.lock` file is generated via the following steps. As noted above, the "install required R libraries via CRAN" step will vary depending on the individual model's needs. Below we show the commands for the `flu_ar2` model, but you will need to change them for yours. | ||||||
|
||||||
- start a fresh temporary [rocker/r-ver:4.3.2](https://hub.docker.com/layers/rocker/r-ver/4.3.2/images/sha256-8b25859fbf21a7075bbc2285ebfe06bb8a14dd83e4576df11ff46f14a8620636?context=explore) container via `docker run --rm -it --name temp_container rocker/r-ver:4.3.2 /bin/bash` | ||||||
- install the required OS libraries and applications (see "install general OS utilities" and "install OS binaries required by R packages" in the [Dockerfile](Dockerfile)) | ||||||
- install renv via `Rscript -e "install.packages('renv', repos = c(CRAN = 'https://cloud.r-project.org'))"` | ||||||
- create a project directory via `mkdir /proj ; cd /proj` | ||||||
- initialize renv via `Rscript -e "renv::init(bare = TRUE)"` | ||||||
- install required R libraries. NB: these will vary depending on the model (see each model's `README.md` for the actual list). For example: | ||||||
1. start a fresh temporary [rocker/r-ver:4.4.1](https://hub.docker.com/layers/rocker/r-ver/4.4.1/images/sha256-f3ef082e63ca36547fcf0c05a0d74255ddda6ca7bd88f1dae5a44ce117fc3804) container via: | ||||||
```bash | ||||||
docker run --rm -it --name temp_container rocker/r-ver:4.4.1 /bin/bash | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rocker containers are built on amd64 and if you don't specify a platform, you get this lovely warning on arm Macs:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads up. Interestingly, I don't see that warning on my Mac. Generally I've been omitting the |
||||||
``` | ||||||
2. install the required OS libraries and applications (see "install general OS utilities" and "install OS binaries required by R packages" in the [Dockerfile](Dockerfile)) | ||||||
3. specify repo via: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
```bash | ||||||
/rocker_scripts/setup_R.sh https://p3m.dev/cran/__linux__/jammy/2025-02-05 | ||||||
``` | ||||||
4. install renv via: | ||||||
```bash | ||||||
Rscript -e "install.packages('renv')" | ||||||
``` | ||||||
5. create a project directory and initialize renv via: | ||||||
```bash | ||||||
mkdir /proj ; cd /proj | ||||||
Rscript -e "renv::init(bare = TRUE)" | ||||||
``` | ||||||
6. install required R libraries. NB: these will vary depending on the model (see each model's `README.md` for the actual list). For example: | ||||||
```bash | ||||||
Rscript -e "renv::install(c('lubridate', 'readr', 'remotes'))" | ||||||
Rscript -e "renv::install('arrow', repos = c('https://apache.r-universe.dev', 'https://cran.r-project.org'))" | ||||||
Rscript -e "renv::install('arrow')" | ||||||
Rscript -e "renv::install('reichlab/zoltr')" | ||||||
Rscript -e "renv::install('hubverse-org/hubData')" | ||||||
Rscript -e "renv::install('hubverse-org/hubVis')" | ||||||
Rscript -e "renv::install('hubverse-org/hubData@*release')" | ||||||
Rscript -e "renv::install('hubverse-org/hubVis@*release')" | ||||||
``` | ||||||
7. create `renv.lock` from within the R interpreter (this fails in bash) via: | ||||||
```R | ||||||
renv::settings$snapshot.type('all') ; renv::snapshot() | ||||||
``` | ||||||
- create `renv.lock` from within the R interpreter (this fails in bash) via `renv::settings$snapshot.type('all') ; renv::snapshot()` | ||||||
- copy the new `/proj/renv.lock` file out from the container | ||||||
8. copy the new `/proj/renv.lock` file out from the container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.