RStudio + mamba/conda R

Hey guys,
We normally use Easybuild for deploying software like RStudio-Server but that locks us in with the version R Easybuild deploys with it. We can install other versions of R and load them with RStudio-Server no problem. The main issue we have is providing the endless strings of LD_LIBRARY_PATH, CPATH, and PKG_CONFIG_PATH for installing and compiling packages. The support for any packages now runs from 15 minutes to over 3 hours to get all the dependencies involved.

Mamba/Conda manages R environments in the most stable fashion I’ve ever seen and never fails to install. I’m having a devil of a time trying to tell RStudio-Server to use my local R environment as the main source for R. I’ve tried setting RSTUDIO_WHICH_R template/script.sh but RStudio Server doesn’t seem to care.

Can anybody please point me in the right direction?

Kenny

Is your Rstudio running in a container? Also I think that there’s yet another file for any given R session. So there are a couple of layers you have to go through.

First, you may need to pass any environment variable to singularity/apptainer through their environment variable prefixes liek SINGULARITYENV_LD_LIBRARY_PATH or similar.

Secondly, we use a wrapper script to start any given rsession. You may have this block in script.sh to write out an rsession.sh file. We’ve seen in the past, that you have to set things in this file as well.

Hi Jeff,
Thanks for the response :slight_smile: .
We don’t run RStudio-Server in a container. We run the OSC/gc_osc_rstudio_server with the Easybuild install of .RStudio-Server/2022.07.2+576-foss-2022a-Java-11-R-4.2.1.

Okay I read up on what rsession does so I think you sent me exactly what I need to set which R to load.

Thanks Jeff! I’ll post my results.

Okay,
I finally reserved a few nodes. I downloaded rstudio-server-rhel-2023.03.0-386-x86_64.rpm and installed it along with R and R-devel and R-core-devel. That required openblas-devel and texinfo-tex.

To RStudio/template/script.sh.erb I had to add:
export PATH=/usr/lib/rstudio-server/bin:$PATH in both the rsession generation and also in the main so both knew where rsession and rserver are.

Using Mamba/4.14.0 I created a mamba env installing r-base and a few packages I wanted. So where I loaded rstudio-server and R modules I commented those out and simply activated my mamba environment. At the end I called rserver with --rsession-which-r $(which R) and it loads any R environment I specify.

We’re considering getting rid of the RStudio-Server modules and any custom R builds published by Easybuild. Using Mamba seems much more managable.

Kenny

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