Error in RStudioGD (): shadow graphic device error: error r 4 (R code execution error)

I am trying to use Rstudio. But when I do this, plot(cars) , which is the main function, I get Graphics Error in R
Here is what I did:

 > plot(cars) Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error) 

I ask you to consult.

+8
source share
7 answers

In Ubuntu 13.10 I had a similar problem with the rstudio server, tried all the different sentences without work. Finally it turned out like this:

  • sudo service rstudio-server stop
  • delete all rstudio-related files ( sudo find / -name "rstudio" | xargs sudo rm -r )
  • remove R: sudo apt-get remove r-base-core r-base r-base-dev
  • delete all R-related files ( sudo find / -name "R" | xargs sudo rm -r )
  • reinstall R: sudo apt-get install r-base-core r-base r-base-dev
  • test R: make sure that the plot (cars) is working in R, it produces a pdf file.
  • reinstall R studio server: http://www.rstudio.com/ide/download/server
+2
source

First I reinstalled RStudio into the latest version (1.1.442) and, following many tips, also the R-base * system (moving to R 3.4.3) using aptitude as follows:

sudo aptitude reinstall libpangocairo-1.0-0 libpango-1.0-0 sudo aptitude reinstall r-base r-base-core r-base-dev

I used aptitude because it is usually better than apt-get to unravel complex dependency trees. Subsequently, when the package was not loaded into the environment, it worked fine, but any package loading created a number of DLL-related errors as follows.

FINAL DECISION (DO NOT REINSTALL):

The error showed up again as soon as I downloaded my homemade library. The real problem is the number of open dlls. If you download too many packages or files, you will get a limit and you will get error messages between maximal number of DLLs reached... or failed to load cairo DLL (this is an error warning) or even lapack routines cannot be loaded . I had these three errors randomly when I downloaded my full dependencies - a makeshift library.

So, I started looking for a solution again. The ultimate goal is to provide more DLLs and do it enough to set the R_MAX_NUM_DLLS environment R_MAX_NUM_DLLS to a larger number (I set it to 500). To avoid problems with setting it up every time you can read the ?Startup documentation and therefore write R_MAX_NUM_DLLS=500 in the Renviron R-HOME/etc/Renviron.site . In my case (Ubuntu: 16.04 it was /usr/lib/R/etc/Renviron.site . This fixed the problem.

+2
source

I had the same problem and found James Mao's answer useful, but I wanted to avoid reinstalling R so that I didn't have to reinstall all my R packages as well. I was able to fix the problem by reinstalling RStudio without reinstalling R, which makes sense because the error is related to RStudio, not R itself. Here are the instructions:

0
source

I had the following error in the Docker CentOS: 7 container when running rstudio-server verify-installation :

 27 Feb 2017 14:17:09 [rsession-rstudio-server] ERROR r error 4 (R code execution error) [errormsg=Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) : error in running command ]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::<unnamed>::evaluateExpressionsUnsafe(SEXPREC*, SEXPREC*, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::<unnamed>::EvalType) /root/rstudio/src/cpp/r/RExec.cpp:159; LOGGED FROM: rstudio::core::FilePath rstudio::session::module_context::findProgram(const std::string&) /root/rstudio/src/cpp/session/SessionModuleContext.cpp:879 27 Feb 2017 14:17:09 [rsession-rstudio-server] ERROR r error 4 (R code execution error) [errormsg=Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) : error in running command ]; OCCURRED AT: rstudio::core::Error rstudio::r::exec::<unnamed>::evaluateExpressionsUnsafe(SEXPREC*, SEXPREC*, SEXPREC**, rstudio::r::sexp::Protect*, rstudio::r::exec::<unnamed>::EvalType) /root/rstudio/src/cpp/r/RExec.cpp:159; LOGGED FROM: rstudio::core::FilePath rstudio::session::module_context::findProgram(const std::string&) /root/rstudio/src/cpp/session/SessionModuleContext.cpp:879 

I fixed it by installing which : yum install which

-1
source

I had the same error and am on Ubuntu. I did not install R via sudo apt-get install r-base , but instead downloaded the specific version , unpacked it and installed it manually using:

 ./configure --with-readline=no --with-x=no --enable-R-shlib make sudo make install 

I did not have cairograpghics installed, which seems to be important for creating 2D graphics with R. So I installed this with:

 sudo apt-get install libcairo2-dev 

Or find the version for your OS here: https://www.cairographics.org/download/

Then I deleted R again, simply by going to the downloaded R folder, which I had previously compiled using the above commands listed below and typed:

 sudo make uninstall 

And then I set it up again and installed the same version of R. It did it. Removing and reinstalling was important, just installing cairographics did not work, you must install it before using ./configure .

-1
source

I had the same problem (although I used the same installation for over a year without this problem). I just needed to restart my computer, and everything was fine again. : D

-1
source

Reinstall the ggplot2 package (install.packages "ggplot2") and call the library. Then it should work

-1
source

Source: https://habr.com/ru/post/1236421/


All Articles