Installing RGDAL in R on Linux

The RGDAL package is used by R and RStudio to plot maps. Under Linux you may encounter one or two errors when trying to install the package:

Error: gdal-config not found.
The gdal-config script distributed with GDAL could not be found.


configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘rgdal’

You experience these errors because R in Linux installs the packages from source (rather than a ready-compiled binary) and you need additional libraries to compile RGDAL. Essentially, the packages libgdal-dev and libproj-dev are required and may be missing. To install them on an Ubuntu system open a terminal (CTRL+ALT+T) and type (or copy and paste):

sudo apt-get update && sudo apt-get install libgdal-dev libproj-dev

To ensure you package lists are up to date and then installs the required packages. Once these are installed on your system you can install the RGDAL package by running the following code inside R:

install.packages("rgdal"); library(rgdal)

Job done.



9 thoughts on “Installing RGDAL in R on Linux

  1. Sebastian Arias says:

    Thanks for your answer. It was very helpful for me in my ubuntu 14.04.

    Regards from Colombia.

    • You could try using Fedora’s package manager (rpm?) to install the required libraries. Otherwise, there might be compiled versions already available you might be able to find with a quick Google search. Good luck

Comments are closed.