Reputation: 5713
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?) ?
Upvotes: 1
Views: 3340
Reputation: 5713
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!
Upvotes: 2
Reputation: 94202
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.
Upvotes: 0