Skip to content

Fix: Configure: Error: Gdal-config not found or not executable

  • by
  • 2 min read
What is Metadata? Types and benefits | Candid.Technology

Linux is preferred by a lot of developers for its simplicity when it comes to installing packages and dependencies with just a few commands. However, that doesn’t go as easy as expected always, and random bugs and errors keep popping up from time to time. 

In this article, we’re looking at the “Configure: Error: Gdal-config not found or not executable” error and giving you three fixes for the problem. 

Also read: Python vs R: Which one is better?


Why does this happen?

As you can probably guess from the error, the issue stems from a missing dependency in either libgdal or rgdal. Depending on which package you’re using in your R scripts, you will have to get the right version installed on your PC. 

Also, make sure you’re using either the development or production version of the library, depending on your environment. Development libraries often have wider error tolerance that lets you get away with more problems in your code which show up as warnings instead of errors.


How to fix this?

Here are three ways you can fix the error. 

Install libgdal

One of the primary reasons why you’re seeing this error is because of a missing dependency or package. Try installing libgdal to see if that fixes your problem.

sudo apt install libgdal-dev

Alternatively, you can also try this command

sudo apt-get install libgdal-dev

If you’re on macOS instead, use this command.

brew install gdal

Install all required dependencies

If installing libgdal didn’t cut it, try installing all the required dependencies for the package to function. Just open a terminal and enter the following commands one at a time. 

apt-get install apt-file
apt-file update
apt-file search gdal-config

Install rgdal dependencies

if libgdal dependencies aren’t working for you, try installing rgdal dependencies instead to see if that fixes the problem. 

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

Once the installation is complete, install rgdal by using the following command:

install.packages("rgdal")

Once done, you can load rgdal in your R scripts using this command:

library(rgdal)

Also read: Is Python case sensitive when dealing with identifiers?

nv-author-image

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: yadullahabidi@pm.me.

>