My problem is i have been able to use rstudio to write code for a long time. However, recently, when i start my rstudio, no matter which button i click or whatever I do, this "Error: Unable to establish connection with R session" pop up. When I tried to edit files, it shows up. When I tried to run code, it shows up. I couldn't remove plots. I could not do anything with Rstudio now. This is being a problem.
I uninstalled rstudio and then reinstall. The same problem still persists.
Please help. It's been a few days that this has been happening already. I really need a fix on this.
Thanks.
Update:
Below are the methods I have tried and the "Unable to establish connection with R sessino" still would not go away.
Resetting the Rstudio desktop by removing the entire folder.
Remove start-up files.Rdata , .Rprofile and .Rhistory and Rprofile.site
Changing software rendering to "Software"
Uninstall R and RStudio and reinstall again.
I have attached my SessionInfo() below.
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_Hong Kong SAR.1252 LC_CTYPE=English_Hong Kong SAR.1252 LC_MONETARY=English_Hong Kong SAR.1252
[4] LC_NUMERIC=C LC_TIME=English_Hong Kong SAR.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 lattice_0.20-38 zoo_1.8-6 digest_0.6.23 later_1.0.0 mime_0.9 grid_3.6.3
[8] R6_2.4.1 xtable_1.8-4 magrittr_1.5 rlang_0.4.2 promises_1.1.0 tools_3.6.3 shiny_1.4.0.2
[15] httpuv_1.5.2 fastmap_1.0.1 compiler_3.6.3 htmltools_0.4.0
None of the above works for me.
Can RStudio please look into it please ? I am working on my master thesis and the deadline is coming up.
Update:
Just notice that every time I started my RStudio, It reopened the multiple browser() windows (for debugging) that was closed previously.
# ERROR: Definition of function 'testing' not found
# in namespace '.GlobalEnv'
I tried renaming the Rstudio-Desktop folder as well as the "other preferences" folder. With a fresh rstudio desktop, It still crashed and the same error message popped up, no matter what i click.
Have you tried changing to software rendering?, you can change it by holding the Ctrl key while opening RStudio, then you should see this menu and change the "Rendering Engine" to "Software".
Yes. I tried rendering engine to software too. Still crashing. Where do I find my Rprofile.site file and how do i check that it does not have anything that could lead to crashing ?
The file is located on your installation folder, something like this C:\Program Files\R\R-3.6.3\etc\Rprofile.site
This contains R commands so check if there is something that could be causing a crash if nothing has modified this file all lines should be commented.
So i located my Rprofile.site file, which is shown below. All lines are commented except the options(help_type="html")
# Things you might want to change
# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")
# set the default help type
# options(help_type="text")
options(help_type="html")
# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")
# set a CRAN mirror
# local({r <- getOption("repos")
# r["CRAN"] <- "http://my.local.cran"
# options(repos=r)})
# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
# if (interactive())
# fortunes::fortune()
I have never experienced this before. The error message just pops up every 10 seconds. Glad that we are on the same boat. Let's wish that they will help us fix it.
Thanks for reaching out. I do not have avast or anti virus software installed on my machine.
Several thing that caught my eyes are that (1) whenever the R script tries to autosave, I got the "Unable to establish connection with R session" message which is "Error in Saving File". (2) Everytime I restart R, it reopens multiple browser windows that was closed previously. And it generated an error message saying function not found in namespace .GlobalEnv. Something is corrupted but I do not know what.