rstudio-server unable to open connection to X11 display when using plots

Ivan Lovric's Avatar

Ivan Lovric

01 Jul, 2012 12:23 PM

Hi there,

I've been having some problems with rstudio-server (installed from source on CentOS) when using plots.
I'm always greeted with this error:

Error in device.call(...) :
Shadow graphics device error: r error 4 (R code execution error) In addition: Warning message:
In grDevices:::png("/tmp/Rtmp17P1PV/14b9a37107ed4ed684c1c18d71505d1d.png", :
unable to open connection to X11 display ''

I've seen some references to this problem in some recent posts but none with a solution. eg:
http://support.rstudio.org/help/discussions/problems/864-rstudio-se...

I already had pango-devel installed when I compiled rstudio-server from source...I
I've thought that perhaps there is some ~/.Rprofile settings to export DISPLAY or something but I cannot
find any documentation on the syntax for this file.

I would greatly appreciate any insight you guys may have on this one.

Thanks,

Ivan

  1. Support Staff 2 Posted by Josh Paulson on 09 Jul, 2012 03:12 PM

    Josh Paulson's Avatar

    Ivan,

    What version of R are you using? If you can, try using R 2.14 or greater. Then we actually don't use pango-devel or x11 as we just rely on R's implementation. Otherwise if you are running an earlier version, the problem might be that we're not picking up pango-devel here.

    Josh

  2. 3 Posted by Ivan Lovric on 11 Jul, 2012 07:34 AM

    Ivan Lovric's Avatar

    Hi,

    Thanks for the reply.

    The only rstudio-server binaries that I can see have been compiled with libpango/pango-cairo is bin/rsession:
    [root@surf bin]# ldd rsession | grep pango

    libpangocairo-1.0.so.0 => /usr/lib64/libpangocairo-1.0.so.0 (0x00007fd914b0b000)
    libpango-1.0.so.0 => /usr/lib64/libpango-1.0.so.0 (0x00007fd9148c0000)
    libpangoft2-1.0.so.0 => /usr/lib64/libpangoft2-1.0.so.0 (0x00007fd9120af000)
    

    I do recall that pango-devel was already installed when I built rstudio from source. I think there issue lies somewhere else, perhaps in an /etc configuration file for authentication or something rather.

  3. Support Staff 4 Posted by Josh Paulson on 11 Jul, 2012 02:56 PM

    Josh Paulson's Avatar

    Ivan,

    Okay thanks for the additional details. What version of R was it that you've got installed and did you build this from source? If you did build from source, then you need to make sure you built R to use the cairo graphics library.

    Josh

  4. 5 Posted by ivan lovric on 16 Jul, 2012 12:40 AM

    ivan lovric's Avatar

    Hi Josh,

    Thanks for the reply.

    We're using R 2.15.0 and we did build it from source. You may be quite
    right this may be what is the issue. May I ask,
    what is your preferred method of installing rstudio-server on CentOS 6.x?

    Thank you kindly,
    Ivan

  5. Support Staff 6 Posted by Josh Paulson on 17 Jul, 2012 01:29 PM

    Josh Paulson's Avatar

    Ivan,

    We don't have a "preferred" method of how to build R from source to work with RStudio Server. It seems in your case, that you just need to make sure to use the cario graphics library and this should be explained somewhere in R's documentation. Another idea is you could look for the source code of the Fedora binary to see how they do it.

    Josh

  6. 7 Posted by Chris Hinshaw on 03 Aug, 2012 03:19 PM

    Chris Hinshaw's Avatar

    Ivan,

    I had the same exact problem and error you had when building R from source. We were also configured with a headless blade so we needed to configure R to use Cairo. I had to go back rebuild R and everything worked correctly. Thanks Rstudio team for an excellent environment

    This is the top of my config.log for R so that you can see what my configuration

    was.

    #

    It was created by R configure 2.15.0, which was
    generated by GNU Autoconf 2.68. Invocation command line was

    $ ./configure --enable-R-shlib --without-x --with-cairo --with-libpng --with-jpeglib

    ---------

    Platform.

    ---------

    hostname = vf-base-2
    uname -m = x86_64
    uname -r = 2.6.32-220.el6.x86_64
    uname -s = Linux
    uname -v = #1 SMP Wed Nov 9 08:03:13 EST 2011

    #

    Thanks to the Rstudio team for an excellent environment

  7. Josh Paulson closed this discussion on 06 Aug, 2012 08:17 PM.

Comments are currently closed for this discussion. You can start a new one.