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

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 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?


Have you tried putting export RSTUDIO_WHICH_R="$HOME/R/lib/R/bin/R" in ~/.profile? (As recommended here:

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:

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

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.

1 Like

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.

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.

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?)

1 Like

I followed these steps with the same result " 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." but I was still getting the old version when launching Rstudio.

After trying all the suggestions in this thread without success, I figured out by chance a simple solution. Just lauch rstudio from the terminal. For some reason, if launch rstudio using the menu icons, it does not use the configurations in the .bashrc file and, therefore, it gets the wrong R with which R. If you launch it from the terminal, it gets the correct result from which R. This works also with the Rstudio Desktop.

1 Like