I'm not able to install sf R package on Ubuntu 16.04 LTS. I tried


as well as


after running

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install libudunits2-dev libgdal-dev libgeos-dev libproj-dev 

Getting the following error message:

configure: error: gdal-config not found or not executable.

ERROR: configuration failed for package ‘sf’

Wonder what is the way to install sf?

  • does it help to install libgdal1-dev? – andschar Feb 6 '18 at 7:09
  • 1
    Try and run gdal-config on the Linux command line. If it doesn't run, it might tell you what package you need for it. If it does run (it should just print a usage message explaining its arguments), something weird is going on and you should maybe log out and in again.... On my system it comes from libgdal-dev which you say you've installed but let's see... – Spacedman Feb 6 '18 at 7:55

This worked for me. Using

sudo aptitude install libgdal-dev

and then

| improve this answer | |
  • In Ubuntu 18.04 installing libgdal-dev was enough – the world is not flat Feb 9 '19 at 14:51
  • Be sure to install default-libmysqlclient-dev on Debian first, otherwise libgdal-dev installation will fail. If you already have MariaDB installed, it will reroute to default-libmariadbclient-dev automatically. – MS Berends Mar 21 '19 at 20:35

For Arch users make sure you have gcc-fortran installed as the dependencies of sf require it specially if you are compiling from source.

sudo pacman -S gcc-fortran

Then make sure you have the following packages installed.

sudo pacman -S gdal proj geos

Finally udunits is not available in the main repos but in AUR repositories.

git clone https://aur.archlinux.org/udunits.git
cd udunits/
makepkg -si

You may use yay if you please.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.