[GIS] Attempting to install pip package produces gdalversion is not defined error

fionagdalosgeo4wpythonqgis

I'm very new to using packages in python.
I'm on Windows 7 64 bit. I've installed OSGEO4w, and I've checked numpy and scipy are installed. I assume GDAL is installed when I installed OSGEO4W, and I put the bin directory where I see most gdal items (C:\OSGEO4W_2.14\bin) into my windows environment path.

I'm trying to install this much needed centerline package:
github.com/fitodic/centerline
I installed pip at the OSGEO4W shell using:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

And then:

python get-pip.py

This installs pip, setuptools and wheel.
I then try to install the package using:

pip install centerline

and it starts installing, but errors out with:

Collecting Fiona (from centerline) Using cached Fiona-1.7.0.post2.tar.gz . Complete output from command python setup.py egg_info: Traceback (most recent call last): File "(string), line 1, in (module) File "c:\users…appdata\local\temp\pip-build-oakjl0\Fiona\setup.py", line 193, in (module) if gdalversion.startswith("1"): NameError name 'gdalversion' is not defined. Command "python setup.py egg_info" failed with error code 1 in "c:\users…appdata\local\temp\pip_build-oakj10\Fiona\

It appears the setup.py script can't find the gdal version. I see there are some issues in the Fiona package, but I'm not sure what to do with those comments. How do I resolve this error so that the centerline package will install?

Best Answer

You need to create the following environment variables GDAL_PATH and GDAL_CONFIG with their corresponding paths. Before Fiona install gdal for python using pip install gdal and then check if it's running properly.

Related Question