====== How do I extend my LD_LIBRARY_PATH for R/R-Studio? ======
When launching [[:advanced:software:rstudio|R-Studio]] from our [[advanced:interactive|Open OnDemand]] service you don't have the ability to preload any custom modules or any paths to self-installed code. Once R-Studio is running it's not feasible to amend the ''LD_LIBRARY_PATH'' of the running application.
Instead, ''R'' offers a generic method of changing environment variables or making other settings changes as it loads. This is the file ''$HOME/.Renviron''.
To add a custom library search path simply open ''$HOME/.Renviron'' in any text editor (create it first if it does not already exist), and set the following:
LD_LIBRARY_PATH=/path/to/your/custom/libraries:${LD_LIBRARY_PATH}
This will add ''/path/to/your/custom/libraries'' to the start of any existing ''LD_LIBRARY_PATH'' entries (such as those set by loading modules). Inside R/R-Studio you can check the content of the variable as follows:
> Sys.getenv("LD_LIBRARY_PATH")
[1] "/path/to/your/custom/libraries:/opt/software/easybuild/software/CUDA/12.8.0/nvvm/lib64:/opt/software/easybuild/software/CUDA/12.8.0/extras/CUPTI/lib64:/opt/software/easybuild/software/CUDA/12.8.0/targets/x86_64-linux/lib:/opt/software/manual/apps/R-studio/2025-05-01-binary/rstudio-2025.05.1+513/lib64:
You can see in the example above that ''/path/to/your/custom/libraries'' has been added to the //front// of the path, which already includes things like CUDA and R-Studio itself.
----
[[:faq:index|Back to FAQ Index]]