shiny, ggplot2, and X11 on R 3.0.2

951 views
Skip to first unread message

Daniel Bowen

unread,
Feb 26, 2014, 7:33:12 PM2/26/14
to shiny-...@googlegroups.com
Hello again. All libraries are up to date (as of a few hours ago).

I recently had our sys admin - let's call him Joe - update R on an Amazon EC2 linux instance to v3.0.2, to deploy some new applications I've written that make use of dplyr. He was able to update R to v3.0.2, but, for whatever reason, he had to do it without X11. Displaying ggplot2 graphics within a shiny app returns an error where the graphic should be ("Error: X11 is not available"). Joe made it sound as if installing X11 on the Amazon EC2 linux instance is quite complicated. I have two questions:

1) is there a way to deploy ggplot2 + shiny without requiring X11? ... or,

2) does anyone know where I might find information about installing X11 on Amazon EC2 linux instance? I did google it, but it's a lexicon I'm not entirely familiar with (and, maybe there's a simple fix someone knows about).

I realize this may also be related to shiny-server.

Thanks!
Dan

PS I am very grateful for the work you all do on development projects like this and ggplot2 and dplyr, etc. These sorts of tools are genuinely changing the way I think and do business.

Yihui Xie

unread,
Feb 26, 2014, 8:50:19 PM2/26/14
to Daniel Bowen, shiny-discuss
Ubuntu/Debian? You rarely have to build R from source -- all you need is

sudo apt-add-repository -y "deb
http://cran.rstudio.com/bin/linux/ubuntu `lsb_release -cs`/"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install r-base-dev

If you have to build R from source, do this first:

sudo apt-get build-dep r-base-dev

That cryptic error message about X11 usually indicates the missing
dependency libpango-dev or libcairo-dev.

Regards,
Yihui

dmontaner

unread,
Apr 24, 2014, 7:19:49 AM4/24/14
to shiny-...@googlegroups.com
Dear Daniel

I am no sure you did manage to solve this post... but just in case.

Most Linux "servers" do not have installed the graphical system X11 and most system admins will not be very kin on installing that (probably is difficult but I do not know if there is some other further issue like security reasons)

The function png in R/linux uses the X11 system and that is why you get the error.

Usually when I implement R code to be run in servers I use the function "bitmap" which does not depend up on the X11 and goes well. What I do not know is whether "bitmap" will go well with shiny...

I hope this helps.

David

zhao...@gmail.com

unread,
Apr 24, 2014, 10:47:43 PM4/24/14
to shiny-...@googlegroups.com

hi, this is a common issue and i have worked out for times. my solution is  sample but a little time-comsuming:
first, you need know what your system version and try  to install the X11 lib (cause the next cairo will need some X11 libs: in centos  you can try 
yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
then, install cairo-devel and recompile your R from source code with ./configure --with-x=no
to check wether the steps above  is ok, open your R  and type capabilities()
you may see

   jpeg       png            tiff           tcltk        X11       aqua         http/ftp s ockets      libxml     fifo   cledit  
  TRUE     TRUE     TRUE     TRUE       FALSE     TRUE     TRUE     TRUE     TRUE     TRUE 
   iconv        NLS       profmem    cairo 
    TRUE     TRUE     TRUE     TRUE
please note that the cairo must be true, and if not ,there must be some thing wrong in your packages'installlation(PS: in your R, cairo package must be also installed)
if you see the output like i mentioned above , it means you can generated common images now.
 PS : this is non of shiny's bussiness.
 

在 2014年2月27日星期四UTC+8上午8时33分12秒,Daniel Bowen写道:
Reply all
Reply to author
Forward
0 new messages