renv and RSPM for binary installs on shared Linux/Mac project

I have a question about the best way to use {renv} and RSPM in a shared project. I want (a) all collaborators to use renv to install packages, and also for installs to go fast using pre-built binaries. Some users/machines are on Ubuntu and others are on macOS. RSPM provides Linux binaries, but I don't believe macOS binaries, while CRAN provides macOS binaries.

I have a project-level .Rprofile where I define package repositories like so:

options(
  repos = c(RSPM = "https://packagemanager.rstudio.com/all/latest",
            CRAN = "https://cran.rstudio.com/")
)

So my renv.lock starts like this:

{
  "R": {
    "Version": "4.2.1",
    "Repositories": [
      {
        "Name": "RSPM",
        "URL": "https://packagemanager.rstudio.com/all/latest"
      },
      {
        "Name": "CRAN",
        "URL": "https://cran.rstudio.com"
      }
    ]
  },
  "Packages": {
    "BH": {
      "Package": "BH",
      "Version": "1.78.0-0",
      "Source": "Repository",
      "Repository": "CRAN",
      "Hash": "4e348572ffcaa2fb1e610e7a941f6f3a",
      "Requirements": []
    },
...

Currently, I think this means that if packages come from RSPM, macOS users will end up installing from source , but if packages come from CRAN, Linux users will end up installing from source. Whether they are designated as RSPM or CRAN depends on whether those entries in renv.lock are contributed by an Ubuntu or macOS user committing to the git repository. Is there any way to do this so that everyone installs everything possible from binaries?

This is a good question. Right now, renv lockfiles don't have a way of encoding different repositories for different operating systems, so sharing lockfiles which might use different repositories on different systems can be challenging.

To make manners a bit more complicated, renv::restore() also reads the lockfile repositories by default, so simply changing the R repos option after the project was loaded may not be sufficient. (Unless you call renv::restore(repos = getOption("repos")) explicitly.)

Could you file an issue at Issues · rstudio/renv · GitHub? I'll need to think about how we can improve the experience here.

2 Likes

Issue filed here: Installing binaries when collaborating across multiple operating systems · Issue #1052 · rstudio/renv · GitHub

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.