OOD Rstudio not respecting environment variables set by Lmod

I’m not sure if this is an R/RStudio or OOD question, but posting here in case someone has come up against the same problems.

We have deployed a fully containerised version of the RStudio OOD app which for the most part is working great. We have several users that want to use some R packages with external dependancies - ratser/terra are the ones I’m working on at the moment.

To make the usage a similar to using R from the CLI on the cluster I’ve followed the instuctions to make the module function availale. Again this seems to work and querying the environment variables that get set in the module file with Sys.getenv() reports what I expect to see - LD_LIBRARY_PATH, PATH etc

Loading modules with module(“load”, “”) and then installing R packages completes without warnings/failures, but then loading the packages fails (even with the modules loaded)

> library(raster)
Error: package or namespace load failed for ‘raster’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/<path-to personal-R-libs>/R/library/Rstudio/terra/libs/terra.so':
  libproj.so.15: cannot open shared object file: No such file or directory

However, if I update script.sh.erb so that the modules are loaded in rsession.sh the shared libraries can be located fine and the R package loaded. so something is seems to be getting read when the session commences and isn’t getting updated when modules are loaded within the R session

I could add a text field to the submission form to collect the modules a user wants to load but was hoping to get the module function working so modules could be loaded on the fly without users having to exit their current session and resubmit the job to start a new one.

Thankful for any pointers anyone can offer

We provide these instructions to our users through an info.html.erb file.

It ends up looking like this (when you press the button to open it):

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