Open nickhir opened 5 days ago
Have a look at the (epic, long) help page for help(Startup)
about what R reads when and where. R_LIBS_USER is one of those things you can there with different Renviron or Rprofile files, it governs how the package library path (i.e. .libPaths()
) is constructed. In general, the files you are after can be read from R's etc/ dir, the user's $HOME dir and the current processes startup directory.
Thank you very much for your answer! I added an .Rprofile
to my $HOME
directory (which is incidentally also the processes startup directory), but it did not change anything.
The output of the R.home()
command is the following: "/usr/local/lib/R"
, however, I have noticed, that I can not change or add any files in the /usr/local/lib/R/etc
directory because its a Read-only file system
.
Furthermore, when I try to run usethis::edit_r_profile()
I get the following error:
Error: [EISDIR] Failed to open '/rds/user/nickhir/hpc-work/software/R': illegal operation on a directory
Do you have any idea what else I could try?
Yes, that can be a problem. These days I work single-user, mostly, and am root here but R is indeed happy to run off a read-only file system.
But let's go back to help(Startup)
. I think you can also have Renviron
read from where an env var points to which may be a clean way to have it picked up. R_ENVIRON_USER
seems to be one way:
$ echo "randomdoodle=bar78" > /tmp/r/renviron_demo.txt
$ R_ENVIRON_USER=/tmp/r/renviron_demo.txt Rscript -e 'Sys.getenv("randomdoodle")'
[1] "bar78"
$
Thank you very much for your support! I am afraid it is still not working.. I have added
export R_PROFILE_USER=/rds/user/nh608/hpc-work/software/R/.Rprofile # also tried without .Rprofile at the end
export R_ENVIRON_USER=/rds/user/nh608/hpc-work/software/R/.Renviron # also tried without .Renviron at the end
to the script shown here and it still does not work... Do I have to modify the singularity exec
command in any way?
@nickhir Were those environment variable settings added to the rsession.sh script (that also sets R_LIBS_USER)?
It seems setting R_PROFILE_USER and R_ENVIRON_USER there have the intended effect (with the rstudio_4.2.sif image listed in the job script). Note the path /rds/user/nh608/hpc-work/software/R/ has to exist in the container (in case it's not being mounted by default).
Hi all,
I have been using the workflow described here to run RStudio on our HPC. Its been working brilliantly so far and makes my life so much easier, so thank you for that!
There is only one thing that I cant get to work: I would like to modify the
.Rprofile
and.Renviron
that is being used by the singularity image, but I cant get it to work. I have tried to place the.Rprofile
and.Renviron
into the directory specfied byR_LIBS_USER
, but the edits did not seem to make any impact (i.e. the settings I have specified inRprofile
did not show up when starting the singularity image.Any help how to accomplish this would be much appreciated!
Cheers!