Is renv suitable and stable to use in production?


I am having to deploy a bunch of scripts to production environment, and the system admin has asked me to deploy in a manner similar to virtualenv with python.

Their primary concern is not to affect packages that might be in use of other teams, and to generally not cause any conflicts when migrating to production.

I have been searching and reading up on renv and it seems to be an equivalent of virtualenv in `python. However, given the urgency and gravity of the matter, I would feel safer if I get advice of expeRts on:

  • whether renv is stable enough to be used in production
  • do I need to use renv within an RStudio project to make it work (so to transfer all of my scripts to an RStudio project before using renv)?

Thanks ever so much

Any project using renv will, by default, use its own project-local environment. Those project libraries are isolated both from each other, and also from the "default" R library paths (e.g. the user or site libraries). If you are using renv with a project, you can rest assured that any packages you install or uninstall will not effect users outside of that project.

I believe the answer is yes. We have a number of users who are productively and effectively using renv in production environments. If you're considering adopting the use of renv as a standard within an organization, we strongly recommend reviewing the documentation at Introduction to renv • renv.

You do not -- renv is designed to work standalone without RStudio. However, when using renv within RStudio, some minor UI affordances will be made to help make renv easier to use (e.g. the packages pane will show packages installed in the project library, and also compare those versions with those in the lockfile.)

1 Like

Thanks ever so much @kevinushey for the reply and for developing renv!

A follow up question to hopefully close this:

As you clarified project here refers to any work we have/are doing in R, as opposed to an RStudio project.
Q: If I use renv with a bunch of scripts and it produces the .RProfile, renv.lock, renv/activate.R, renv/library, to be able to migrate to production, do I ask the system admin to copy these files to our new "home", from where I will renv::restore?

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.