Non-programmer here struggling to get RStudio to work with an updated version of R. I hadn't updated R in a while, and when I did so to 4.5.1, I found it won't run due to a Temp directory space issue (I'm on Windows, and my username has a space in it). I resolved this by creating an .Renviron file that says:
TMPDIR=C:/RTemp
TEMP=C:/RTemp
TMP=C:/RTemp
This worked, but when I run RStudio 2025.09.1 or 2025.09.0, it won't open and says "Could not locate an R installation on the system." Everything is installed in the standard places in Program Files--I previously tried installing R in C://R but that didn't resolve things. More background info on what I was trying here: https://stackoverflow.com/questions/79784087/rstudio-not-updating-to-new-r-version-or-downloading-packages-windows-username?noredirect=1#comment140780910_79784087. Since then I've completely uninstalled and reinstalled R and RStudio a few times (including deleting the various %appdata% folders I believe I was supposed to delete).
Apologies if this question has been asked before---I know a similar issue was noted a few years ago but haven't been able to find the solution.
Do you get the "Choose R installation" dialog when you start RStudio? If not, hold down Ctrl immediately after starting RStudio and it should appear.
Then try browsing to the location you have R, specifically select RTerm.exe inside the x64 folder. If that doesn't work then something else is going on.
Thanks! Holding Ctrl worked to let me browse to R, but I'm still getting the error message "an error occurred while attempting to load the selected version of R. Please select a different R installation."
How did you find this? As far as I can tell, on recent versions of R (I tried with 4.5.1 on Windows), the environment variables TMP, TMPDIR, and TEMP have no effect on the location of the temporary directory. Also, I am very surprised if the space in username causes the problem, as it's quite common for Windows users, so we would see a lot more people with the same problem.
Are you able to open R directly, by double-clicking on C:\Program Files\R\R-4.5.1\bin\Rterm.exe?
You could also try to open R without any configuration file, in case that's the cause. For that, in the terminal (cmd), run with the quotes: