1

I Installed R-3.0.2 from source on Ubuntu Server 11.10 (sudo ./configure, sudo make) and want to be able to generate png-files (not view them) on the server. When i try to run "png();" in R I get the following Error:

Error in .External2(C_X11, paste("png::", filename, sep = ""), g$width, : unable to start device PNG
In addition: Warning message:
In png() : unable to open connection to X11 display ''

Tthe following dependencies are installed:

libpng12-dev (1.2.46)
java (1.6.0_27)
xorg-dev (1:7.6+7ubuntu7.1)
libcairo-dev (1.10.2-6ubuntu3)...

Update:
libx11-dev (2:1.4.4-2ubuntu1)
libxt-dev (1:1.1.1-2)

(could be I forgot some)

Running capabilities(); in R give the following:

jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE FALSE FALSE FALSE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE FALSE TRUE

So png is ok, but X11 seems to be missing, any idea's what I need to install/do to get png capability working in R (to get X11 up and running?) ?

user1834095
  • 5,332
  • 2
  • 20
  • 38
  • possible duplicate of [How to run R on a server without X11, and avoid broken dependencies](http://stackoverflow.com/questions/1710853/how-to-run-r-on-a-server-without-x11-and-avoid-broken-dependencies) – agstudy Feb 28 '14 at 13:29
  • I don't mind installing X11, I just don't now how. Also I need to be able to run the 'R' command just like that and not via some additional software (like the xvfb-run suggested in that post) – user1834095 Feb 28 '14 at 13:49

2 Answers2

2

Found the answer to my own question thanks to comments from @Spacedman

Turned out I still needed to install the 'libpango1.0-dev' package. "capabilities('X11');" still gives FALSE but "png();" no longer gives errors, so my problem is fixed. Thank you for pointing me in the right direction!

user1834095
  • 5,332
  • 2
  • 20
  • 38
0

You need to install the relevant X11 development library packages on your system, and recompile R so it says TRUE in the X11 capabilities.

sudo apt-get install libx11-dev libxt-dev

or maybe just the xorg-dev metapackage:

sudo apt-get install xorg-dev

might be enough. Then run the configure step of the install until it says it has got X11 capabilities. It should output it on screen during the configure step, so you don't need to churn through a compile to find out.

Note that png support doesn't need a connection to a working X server anymore so anything you read about needing virtual X server process (via xvfb) on headless servers does not apply.

Spacedman
  • 92,590
  • 12
  • 140
  • 224
  • All those packages are already installed (see my updated question for versions). When I run ./configure I get this: Interfaces supported: X11 External libraries: readline Additional capabilities: PNG, JPEG, NLS, cairo Options enabled: shared BLAS, R profiling However, X11 capability is still FALSE – user1834095 Mar 01 '14 at 16:13
  • Check your config log file to see what it can't find. – Spacedman Mar 01 '14 at 16:19
  • Might pango be the problem? How can install a newer version? I found this in the config log: checking whether pkg-config knows about cairo and pango... no checking whether pkg-config knows about cairo... yes checking whether cairo is >= 1.2 and works... yes – user1834095 Mar 01 '14 at 16:36