at wits end trying to get RStudio to use a different R version. PLZ HELP!

Hey all. Upgrading R and can't get RStudio to see it. Running Ubuntu 20 , and having the issue in both RStudio Desktop and RStudio Server. Happy to have a solution for any doesn't need to fix both. Installed a new version of R and followed instructions here: https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-the-RStudio-Desktop-IDE

and changed RSTUDIO_WHICH_R= in profile , but restarting RStudio Desktop from Launcher OR from CLI does not change the R version when it loads and also restarting RStudio Server still fails and loads the previous version of R.

Thanks in advance for any help you can offer. I have had to switch temporary to VS Code for R work until this is resolved which has been okay for now. But I miss some of the RStudio behaviors and would like to switch back. I even updated and installed a new version of RStudio. But new version didn't see new version of R either.

Currently running 2021.09.2+382

is there any other info that I could provide to help? I feel like having an IDE use the new version of the programming language should be possible and I am missing something simple here.

A few pointers:

  • Can you share the line containing RSTUDIO_WHICH_R and the full path and name of the profile script (e.g. /home/user/.profile or similar)
  • If you log into the linux box, do you then see the variable RSTUDIO_WHICH_R (e.g. if you run echo $RSTUDIO_WHICH_R)
  • On the same note, if you log into the linux box, can you actually run the R binary that you reference in RSTUDIO_WHICH_R ?
  • Lastly you could check out your home-directory and move aside or remove existing .rstudio, .local/share/rstudio and .config/rstudio to exclude the possibility that the old configuration is still retained.

Thank you for taking the time to help me out. Much appreciated. To answer your questions:

  1. line is export RSTUDIO_WHICH_R=/opt/R/4.1.2/bin , name and path is ~/.profile , but also tried it without the export...

  2. I see the variable, but its not the right one:

echo $RSTUDIO_WHICH_R
/usr/bin/R

which now makes me think its more a config issue on my end

  1. yes I can. the binary there works when selected in other IDE's like VS Code or if I run R directly from the location.

  2. I have not tried this. Trying now. This did not solve the problem, which is probably not-shocking to you after reading number (3) , but it was kinda hilarious to watch RStudio open with all my themes and layout stuff gone after removing those files... its so WHITE

There you have the first problem: RSTUDIO_WHICH_R must point to the R binary, not the path containing it, so you probably should set something like RSTUDIO_WHICH_R=/opt/R/4.1.2/bin/R in your profile.

But since it still points to /usr/bin/R, something else must be wrong: Depending on the type of shell you are using on linux, your RSTUDIO_WHICH_R variable definition could be overwritten by other files sourced at shell startup, e.g. for bash ~/.bash_profile or ~/.bashrc, for tcsh ~/.cshrc and so on (you can find the type of your shell via echo $SHELL).

You also could have added the RSTUDIO_WHICH_R definition to the system-wide config files in /etc. Try running grep RSTUDIO_WHICH_R /etc to see if this finds something.

thanks Michael , this worked for me. much appreciated.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.