rstudio / renv

renv: Project environments for R.

Home Page:https://rstudio.github.io/renv/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

renv install linking from cache only

pedriniedoardo opened this issue · comments

Hello,
I have a general question about the initialization of a new project using renv.

This is a sample case:
I create a new renv project with renv::init
I need to install tidyverse, I use renv::install("tidyvese") (Tidiverse was already installed before with all the dependencies at the time of installation, and is available in the cache).
renv repopulates the project folder with the requested packages and relative dependencies. Some packages are linked from the cache since they are already available. Some others might have changed over time; therefore, they are not linked from the cache but built from source or installed as binaries.

...
- Installing gplots ...                         OK [linked from cache]
- Installing ROCR ...                           OK [linked from cache]
- Installing Rtsne ...                          OK [built from source and cached in 23s]
- Installing scattermore ...                    OK [built from source and cached in 5.9s]
...

The question is:
Can I install only the version of the packages already available in the cache and avoid installing a newer version?
Is there a specific argument in renv::install() or a different renv:: command?
Should I just copy the renv folder from an old project and use that one in the new project?
Does it make sense to copy only from the cache to avoid installation of multiple newer versions of dependencies packages?
Should I install only the version of the packages already available in the cache and avoid installing a newer version?

Can I install only the version of the packages already available in the cache and avoid installing a newer version?

I don't think this is currently available, unfortunately.

Should I just copy the renv folder from an old project and use that one in the new project?

This is probably the most straightforward solution for now.

Does it make sense to copy only from the cache to avoid installation of multiple newer versions of dependencies packages?

I think it depends -- there's no guarantee that the combination of packages pulled from the cache would be compatible, hence why renv::init() normally prefers using the latest-available versions of packages. If you want to "freeze" the versions of packages being used, it's probably better to create a lockfile via renv::snapshot(), and then use renv::restore() to install those same package versions (which would then be discovered in the cache as appropriate).