Search code examples
ranacondaubuntu-16.04x11gtk2

Ubuntu 16.04: fatal error: X11/Xlib.h: No such file or directory


I am trying to install Rgtk2 (dependency for rattle). I am using R thru Anaconda. I am getting the following error.

In file included from Rgtk.c:7:0:  
/usr/include/gtk-2.0/gdk/gdkx.h:32:10: fatal error: X11/Xlib.h: No such file or directory  
 #include <X11/Xlib.h>   
          ^~~~~~~~~~~~ 

I tried the following workarounds as found in StackOverflow and other blogs.

  1. Installed libx11-dev, mesa-common-dev, libglu1-mesa-dev, libxrandr-dev, libxi-dev

  2. Tried installing RGtk2_2.20.31 from source.

Every time I am getting the same error.


Solution

  • anaconda has its own environment, which by default usually lacks X11 headers(e.g libx11-dev, or whatever you call it). Try "conda install -c conda-forge xorg-libx11" . It worked for me when a certain R-package threw an error "X11/Xlib.h : No such file or directory".