10

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

install.packages("sf")

as well as

devtools::install_github("r-spatial/sf")

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?

2
  • does it help to install libgdal1-dev?
    – andschar
    Commented Feb 6, 2018 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
    Commented Feb 6, 2018 at 7:55

2 Answers 2

8

This worked for me. Using

sudo aptitude install libgdal-dev

and then

devtools::install_github("r-spatial/sf")
2
  • In Ubuntu 18.04 installing libgdal-dev was enough Commented Feb 9, 2019 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
    Commented Mar 21, 2019 at 20:35
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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