Multiple R versions via Renv on Workbench server

Goal

I want to be able to choose between multiple user-installed R versions on a Posit Workbench server (2022.07.2+576.pro12) via the RStudio Web UI. Preferably by using the Renv version manager.

Background

  • On a previous development server, we worked with Renv to manage multiple versions of R. Important: I'm talking about Renv and not the environment/library manager R package renv (confusing - I know).
  • Why?
    • Because we also use PyEnv to manage our Python installs and both packages are based on the same framework.
    • Because we consider it to be safer to have user-based interpreters rather than system-wide interpreters.*
  • This way, users can install multiple required R interpreters in their own home directory (e.g.: $HOME/.Renv/versions/4.0.0).
  • Our installation of Posit Workbench is completely new and I have no previous experience with configuring it.

My unsuccessful attempts (based on docs)

As per the documentation, Posit Workbench scans for and automatically discovers versions of R in central directories which are shared across users (e.g. /opt or /usr). Is it possible to include the user-based directory of R versions installed by Renv? Or can we only work with system-wide interpreters which are then used in user-specific renv environments? The generalised version would be $HOME/.Renv/versions/.

I have tried (in multiple combinations) without success:

  • configuring Workbench to not scan the default locations (cf. "Determining available versions" in docs)
r-versions-scan=0
  • adding the folder of R versions & a specific R version to my user using the profiles file. (cf. "Creating profiles" in docs)
[michael]
r-version = /home/michael/.Renv/versions
# as well as /home/michael/.Renv/versions/4.0.0
# (even though I don't want to lock a user to one specific version)
  • adding a specific R version using the r-versions file. (cf. "Determining available versions" in docs)
Path: /home/michael/.Renv/versions/4.0.0
Label: Renv 4.0.0
  • using both my specific home dir home/michael as well as the general $HOME
  • (after changing these configs, I have used both sudo rstudio-server restart and rstudio-server reload)

*e.g. for Python, venv creates a symlink to the system-wide available interpreter, so corruption of a Python interpreter means corruption of that interpreter for everyone. pyenv (as well as Renv) creates an interpreter specific to one user. Corruption of that interpreter influences only that specific user and not the others.

Thanks!

PS: as a new user, I can only add 2 links in the post - so I had to describe the location in the docs.