Hi
I recently upgraded to Linux mmint 19 and reinstalled R and Rstudio on my
computer. I keep getting this error when I try to plot something. The plot
function works fine in R.
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In addition: There were 50 or more warnings (use warnings() to see the
first 50)
50: In
grDevices:::png("/tmp/RtmpOOKAJm/c23d93214a644f4b98ba6066e3bdb2e8.png",
... :
failed to load cairo DLL
I check various forums, and I updated Cairo and Pango libraries and
reinstalled R and Rstudio but still get the error. Could someone help me
out with this problem? Thanks
Here are the outputs to SessionInfo
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/local/lib/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1
>
> options('device')
$device
[1] "RStudioGD"
Thanks in advance for any advice,
-Shyam
You seem to have hit all the points in the advice here:
https://support.rstudio.com/hc/en-us/community/posts/115008346868-Error-plotting-in-RStudio-Server-Error-in-RStudioGD-
You said that you already rebuilt R against that newly-installed Cairo library?
Thanks.
Yes, though to make sure, I'll do it again. Is there some path that I need to upgrade? Maybe Rstudio is looking for a file in the wrong place.
How did you build and configure R? Note that you'll need to configure R with --with-cairo
for plots to work.
I compiled it from source. I used the following configure command:
./configure --prefix=/opt/R/3.5.1 --enable-R-shlib --with-blas --with-lapack --with-libpng --with-jpeglib
I'll reinstall with --with-cairo, after I issue a make uninstall command for R and uninstall Rstudio. Thanks for the tip.
Hi,
I reconfigured with
./configure --prefix=/opt/R/3.5.1 --enable-R-shlib --with-blas --with-lapack --with-cairo --with-libpng --with-jpeglib
I still got the same error.
This old support article might be relevant: https://support.rstudio.com/hc/en-us/community/posts/115007464847-Can-t-plot-because-Failed-to-load-cairo-DLL-R-3-4-RStudio-Server-Open-Source-1-0-153
It would be useful to know what the extra warnings emitted by R here are, as well. (You can enter warnings()
after attempting to generate the plot to see what warnings are being emitted)
1 Like
Hi,
I was able to fix the issue thanks to your post. So, I did warnings() and I got this message:
Warning messages:
1: In grDevices:::png("/tmp/Rtmp700CWS/59baa711a2fb4bb48fc3ff4cdb6c579d.png", ... :
unable to load shared object '/usr/local/lib/R/library/grDevices/libs//cairo.so':
/usr/local/lib/R/library/grDevices/libs//cairo.so: cannot open shared object file: No such file or directory
2: In grDevices:::png("/tmp/Rtmp700CWS/59baa711a2fb4bb48fc3ff4cdb6c579d.png", ... :
failed to load cairo DLL
I looked in /usr/local/lib/R/library/grDevices/libs and did not find cairo.so but there was one in the /opt directory so I created a soft link
sudo ln -s /opt/R/3.5.1/lib/R/library/grDevices/libs/cairo.so cairo.so
and plots are working fine. I missed this earlier, because it gave 50 warnings and since the last 15 or so looked similar, I didnt scroll up to see the first one, assuming that they were all the same.
Thanks a lot kevinushey and EconomiCurtis for your help.
-S
2 Likes
looks to me like an extra / in the path
Warning messages:
1: In grDevices:::png("/tmp/RtmpPo9zq7/1273aa6e4d4543029217f6a08f4fd4fe.png", ... :
unable to load shared object '/usr/lib64/R/library/grDevices/libs//cairo.so':
1 Like