Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such file or directory: 'gdal-config'

I am trying to install fiona and geopandas on a mac machine.

I have installed GDAL trough brew install gdal --HEAD

If I try install fiona, I get the following:

sudo pip3 install fiona
Collecting fiona
  Downloading Fiona-1.8.18.tar.gz (1.3 MB)
     |████████████████████████████████| 1.3 MB 4.7 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/[email protected]/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-sk0rqerp/fiona_e389978ed5a44635a5158a0ba3df8562/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-sk0rqerp/fiona_e389978ed5a44635a5158a0ba3df8562/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/tmp/pip-pip-egg-info-bngdnoq7
         cwd: /private/tmp/pip-install-sk0rqerp/fiona_e389978ed5a44635a5158a0ba3df8562/
    Complete output (2 lines):
    Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
    A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
like image 279
emax Avatar asked Jan 14 '21 09:01

emax


People also ask

How do I specify Gdal API version?

Make sure you choose the file as per your python version, if it is 3.7 then there would be cp37. go to command prompt, put cd and then pip install , install GDAL wheel file, then fiona, then just do pip install geopandas.

Why can't I run GDAL-config with sudo?

It could be that the gdal-config program isn't in your path when you're SUDO'ed. The root user may not have /usr/local/bin in the path, so when you execute the command with SUDO, it fails to find the command in the path, but when you do it with your 'regular' user, it finds it.

How to install GDAL in Ubuntu?

In ubuntu, a simpler solution to install the latest gdal for python3: install library files via libgdal-dev, and python wrapper via python-gdal You may also encounter problem whith memory usage. When running pip install gdal==2.2.3 gcc is launch to compile something and it raises memory usage.

Where can I find GDAL header files?

However GDAL is installed correctly and the header file is located at /usr/include/gdal/cpl_port.h. Is there some environment variable for GDAL that needs to be set in order for pip to find the header files? selimnairb's answer is close but you wont have the headers unless you've installed libgdal-dev:

Why is my GDAL version not installing?

Each gdal version might assume different version of GDAL and will fail installing if expected version is not present in the system. Python package pygdal is alternative to gdal, which installs exactly the same stuff as gdal, but does it in much more virtualenv friendly manner. pygdal comes in versions reflecting related GDAL version.


1 Answers

This problem occured for me when trying to install geopandas on a M1 Mac (using the command pip3 install geopandas)

Using homebrew package manager, install the gdal package:

brew install gdal

Then try again installing the failed pip install:

pip3 install geopandas

like image 150
Mark Avatar answered Nov 15 '22 08:11

Mark