Installing other version of R without root access and working on RStudio Server

rstudioserver

#1

I am working on a server without root access.

I need a newer version of R in order to install some libaries.

I am trying to install R in my local folder and to make R Studio Server use it.

I am mocking the process on a local Ubuntu Machine 14.04.5 LTS, but afterwards I would need to perform it on a Red Hat Enterprise Linux Server release 6.9 (Santiago).

What I have tried so far:

cd ~
wget http://cran.rstudio.com/src/base/R-3/R-3.4.3.tar.gz tar xvf R-3.4.3.tar.gz cd R-3.4.3

I tried this:

./configure --prefix=$HOME/R --enable-R-shlib

But it failed due to not due to not having libX11 installed on the Ubuntu machine. So, I proceeded with:

./configure --prefix=$HOME/R --enable-R-shlib --without-x
make && make install

I added these lines to my ~/.bashrc file:

export PATH="$HOME/R/bin:$PATH"
export RSTUDIO_WHICH_R="$HOME/R/lib/R/bin/R"

After all this which R gives the correct R location. If I type R in the console I get to the new version of R.

On my ubuntu machine, I switched to sudo user and restarted the RStudio Server. Something potentially I could ask for the administrators of the RedHat machine.

However, even after restart, when I log into RStudio Server from a webbrowser with the account which has the new R version, I still get to use the old version of R.

Any ideas what I am doing wrong?

Thanks


#2

Have you tried putting export RSTUDIO_WHICH_R="$HOME/R/lib/R/bin/R" in ~/.profile? (As recommended here: https://support.rstudio.com/hc/en-us/articles/200486138-Using-Different-Versions-of-R)


#3

I just tried it and it still does not work.
Furthermore, there it says:

(as opposed to from a terminal)

which I though is the way I was doing it :slight_smile:


#4

Oh, yes, that’s just for Ubuntu desktop. Sorry!


#5

If you have root access then maybe try /root/.profile. I think RStudio is running as root and so it won’t source your .bashrc.


#6

I have root access to the ubuntu machine I am mocking the process to, but I do not have access to the root on the server I am trying to upgrade R into.
After all, if I had root access I would just upgrade R.


#7

This is a compelling question, but unfortunately I do not have much to contribute. It looks like you may have already found this helpful post on the subject. I want to mention it in case others find this thread

I think @mhenderson hit the nail on the head - my understanding is that RStudio is running as root, so that is the user executing the which R is root (and your own which R does not contribute)

Another possible workaround would be configuration of the server to point at a different R binary, but again this doesn’t help b/c it requires admin / root privileges.

http://docs.rstudio.com/ide/server-pro/r-sessions.html#r-executable-and-libraries

The best solution is RStudio Server Pro, which enables multiple R versions installed side-by-side (presuming that the admin would then manage the multiple versions having been installed). It prevents the concerns about breakage that typically come with an upgrade, though.

But again, that’s not helpful to your predicament. I will keep noodling and see if I can think of anything more constructive. (like running your custom version of R in the terminal of the IDE? :slight_smile: That’s probably a bad idea… but do-able, maybe?)