RStudio cannot connet to R

Hello, my R Studio is not connecting with my R properly. I constantly get the prompt 'Unable to establish connection with R session'.

I have found similar posts with no solution, and have tried to uninstall and reinstall both multiple times, have tried different versions, restarted R sessions, etc. It will sometimes allow a few packages to be downloaded and then give the same warning.

I have opened R and it works fine. So, there is something with the connection? I have a Lenovo Thinkpad T490, and none of this is using the OneDrive.

I currently have RStudio 1.4.1106 and R 4.0.4. Can anyone help me?

1 Like

This can be commonly caused by anti-virus interfering; are you running antivirus on this computer? if so, can you disable it and see if that resolves the problem? Most antivirus programs allow you to mark certain applications as trusted, as well.

Thanks for the response. I tried that as well and it didn't make a difference.

Do you try to work on R software without the use of Rstudio?

Hello, R does work- I've checked and just rechecked again. For some reason, it seems RStudio is not able to keep the connection to it.

Do you try to download a old version of R studio?

I did and that didn't work either

Try to load old versione of R (for example 3.4) and lunch it with Rstudio?
Are you sure that you did not make mistake during the loading of Rstudio? It is the first time that I saw this problem with Rstudio. I work with different version of R and it works with all version without problem and I have the antivirus and it did not interfer never on Rstudio.

I've tried older versions of both R and RStudio. I just did it again to make sure- and R studio is still acting the same way. I've seen other similar comments on this forum but there was never a conclusion to them. I'm not sure what else to do and really need it to work.

Did you follow this process in sequence?

Hi @snow_breeze, I did follow that sequence

Does the path in your Global Options setting point to the correct location? You can manually set it.

Use the Tools/Global Options pull down menu from within RStudio, then in the General section, the first setting is to the location of your R session. Edit as necessary if it doesn't point to a correct location.

If it does point to the correct location, might you have installed R and RStudio with different permissions such that RStudio can not access the R location?

@Old_FORTRAN_Dog the path is correct. I don't fully undrestand why the bottom two show (see picture). Could this have something to do with it? I downloaded both R and RStudio without changing any of the automated settings. I really need this to work! Do you have any other suggestions?

I'm not sure what those bottom two files are, I suspect they are related to some windows internal copies or similar process. I have one on my system from R 4.0.4, which I just installed.

I am just using the default 64-bit installation. Note that I generally don't install the 32-bit version of R. I'm not sure I've ever needed it, and I had one program that kept defaulting to it. Therefore, I just don't install it.

I guess I would recommend you completely remove both RStudio and all R versions you have. Then reinstall again, as the same user, installing R first, then R. You could probably add a reboot in there after the uninstall, just to make sure everything is cleared out of your systems memory. If that doesn't fix things, I'm at a loss.

I've uninstalled and reinstalled, and this time only installed the 64-bit, and also did those other suggestions of rebooting. It is still telling me that it can't connect to the R session. This is the only computer I can access, and I need to use R /RStudio for work. Is there anything else I can do?

Hi Cheryl,

Well, that is frustrating. I'm out of ideas personally, but I see there are a number of other things you may try at this link https://codingcompiler.com/unable-to-establish-connection-with-r-session/
It refers to another RStudio forums post, but this link has a reformatted list of everything to try.

Other that that, I think you'll have to wait for RStudio folks to get involved.

Good luck!

Thanks for all your help. I will keep searching. How do I get the RStudio crew involved?

@Old_FORTRAN_Dog, @snow_breeze, @Jo1984, @MikeBess

There was malware on my computer, that once removed, the session seems to be working!

Thanks for the responses.

Great (well, sort of), glad you got it sorted out. Now have fun with R!

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.