Shiny server + renv

Currently looking to handling package dependencies in my shiny app using renv. I was wondering if there is a best practice for dealing with packages from development with shiny server production packages.

For example:
the Shiny server uses the global system library path to use packages. However renv's packages are stored in the renv directory.

Is it possible for either 1) the renv install the packages from the global system library or 2) somehow link the library that shiny server uses to the renv library


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

(Reopening this topic as it came to me through a support channel, and I think the answer is important for people to know)

By default, renv creates project libraries that cannot be moved to a different machine or even user account, due to its reliance on a global cache that sits outside of the project directory. This is exactly the behavior that you want if you're doing local development, but it is problematic for your scenario.

Fortunately, renv includes a solution for this problem. On the development machine, inside the project, call renv::isolate() and this will remove the reliance on the cache. You should then copy the entire project directory, including the project-specific .Rprofile, to the server.

Hope that helps.

1 Like