john mangual
john mangual

Reputation: 8172

trouble installing Fiona in python cpl_error.h: No such file or directory

I have tried to install geopandas two different ways: pip install geopandas or by cloning

git clone https://github.com/kjordahl/geopandas

In both cases, the installation file setup.py runs for a while and then returns this error message:

src/fiona/ogrinit.c:300:23: fatal error: cpl_error.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

fiona is interface to OGR so Python can read geospatial data. cpl_error.h seems to be missing. What can I do?

Upvotes: 5

Views: 3380

Answers (3)

user1632928
user1632928

Reputation: 252

try installing gdal dev binaries with:

sudo apt install libgdal-dev

and fiona later on:

sudo pip install fiona

Upvotes: 3

irfanghani
irfanghani

Reputation: 1

Go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal and download the (fiona).whl file

pip install C:\Users\Downloads\Fiona-1.8.4-cp36-cp36m-win_amd64.whl

If you encounter error then read below

download the correct version of fiona else you will an error Fiona-1.8.4-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.**

to know which version is supported Use the below command in the python ide

**import pip._internal;**
**print(pip._internal.pep425tags.get_supported())**

output:- [('cp36', 'cp36m', 'win_amd64'), ('cp36', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'), ('py36', 'none', 'any'), ('py3', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any'

choose the cp(version) which is mentioned in the output

Upvotes: 0

JesseBikman
JesseBikman

Reputation: 632

If you are using homebrew on OSX:

Runbrew install gdal before running pip install fiona.

Upvotes: 0

Related Questions