Hi,
I am trying to configure different library locations for different users/groups in Rstudio-server.
Is there a way of achieving the same?
PS - I am using R.4.4. and ubuntu 19.
Regards,
Pulah
Hi,
I am trying to configure different library locations for different users/groups in Rstudio-server.
Is there a way of achieving the same?
PS - I am using R.4.4. and ubuntu 19.
Regards,
Pulah
There are a variety of ways to do this, but depending on your motivations they may not be what you're after. I'd recommend environments.rstudio.com - once you know what strategy you want it'll be easier to give you an implementation recommendation.
The short answer, it is going to be easier to have different R installations (they can be the same version) with different site libraries for users, than to specify different libraries for different users / groups that share the same R installation.
Thanks for the response @slopp.
I was thinking more from the perspective of setting some variable like
[username]
r-lib = library_path
in etc/rstudio/profiles
is this possible?
Regards,
Pulah
To share experience, we also encountered the need of specific site libraries accessible only fro some specific groups.
For that we used the R_LIBS_SITE
environment variable.
At first, we used to put the logic in the linux initialization session's files, like /etc/profiles.d/r-site-lib.sh
. This file is source for every user as part of the initialization of his linux session.
In this file, we put this logic:
R_LIBS_SITE
To help with that, we are now using modules (with Lmod) to help manage the groups libraries and R_LIBS_SITE
modification. the module load ...
calls are also put in the profiles
file.
We use this strategy in the company to isolate some packages that should be only accessible to some users on the servers. We also could have chosen another session initialization mechanism supported by RStudio Server Pro (like R version prelaunch script)
Otherwise, users are managing there own libraries themselves and we encourage the use of projects libraries (through renv
) to manage specific locked libraries for project, specifically those that aims to be products delivered to other production environments.
Hope this helps !
Thank you for your response @cderv.
Let us say that we have two users using the different versions of the same library. These two versions are being kept in different directories. Seems like adding both these libraries to R_LIBS_SITE
without somehow explicitly mentioning the version to import in the source code will result in incorrect package import for one of the users.
Is there a way to avoid this in RStudio Server? I.e. without the explicitly mentioning the version to import in the source code?
Regards,
Pulah
For this, I would definitely follow the advices from Sean above. A strategy with project specific libraries using renv
could be a way to deal easily with all this.
if you want to do library(mypackage)
in your code, but have different versions used, you would need to have both versions installed in different location and change .libPaths()
to the correct one. However, with the dependencies and all, I really think you should look into environments.rstudio.com and see what seems best for you.
Can you provide your package in a CRAN-like repository so that your user would download and install the version they need for their project (using maybe renv
for project library management)
What do you think ?
I was able to set the required locations for the specific users by changing the .libPaths for the users in .Rprofile file.
Thank you for your help Christophe and Sean.
Regards,
Pulah
Glad you found a solution that suits your need!
If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.