Using lmod/modules with RStudio

In RStudio is there a way to integrate or load environment modules before startup?

The issue is: we use an environment modules system on our server. Some R libraries depend on system libraries, for instance rgdal depends on gdal. This works perfectly in R, we will load the necessary modules into our environment with lmod before launching R, and R will be able to find them. This is not the case in RStudio as there does not seem to be a way to load these into our environment beforehad. library(rgdal) will of course fail with ' cannot open shared object file: No such file or directory'

I am wondering if there is some sort of global (or user specific) file where we can instruct RStudio to load these modules into the environment before startup. If not, if there is some way to add the PATH of these libraries instead so RStudio knows where to look, that would work too.

1 Like

For RStudio Server Pro the answer is easy: You can specify necessary modules or a script in the extended R version definition, c.f. See also for other hooks available in the Pro version. Offhand I don't know a good solution for this in the open source version.

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.