6

I need to install Geopandas which depends on Fiona and GDAL with pip on Python 3.6. I have installed the GDAL library on Python using the wheel file downloaded from here.

Processing c:\users\_chena\downloads\gdal-2.4.1-cp36-cp36m-win_amd64.whl
Installing collected packages: GDAL
Successfully installed GDAL-2.4.1

Then I tried to pip3 install geopandas. I encountered the following error:

Collecting geopandas
  Downloading https://files.pythonhosted.org/packages/f0/5d/916b7268ef551fa9647c
e12220e9a68006374f1ce5b0ddaf1cd0df2880b7/geopandas-0.4.1-py2.py3-none-any.whl (9
22kB)
    100% |████████████████████████████████| 931kB 4.1MB/s
Requirement already satisfied: pandas in d:\aaa_workspace\alex\supportsarah\hist
oricalplanburnwindowsproject\venv\lib\site-packages (from geopandas) (0.24.1)
Requirement already satisfied: shapely in d:\aaa_workspace\alex\supportsarah\his
toricalplanburnwindowsproject\venv\lib\site-packages (from geopandas) (1.6.4.pos
t1)
Collecting fiona (from geopandas)
  Downloading https://files.pythonhosted.org/packages/41/9d/63696e7b1de42aad294d
4781199a408bec593d8fdb80a2b4a788c911a33b/Fiona-1.8.6.tar.gz (1.7MB)
    100% |████████████████████████████████| 1.7MB 7.9MB/s
    Complete output from command python setup.py egg_info:
    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.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\_chena\A
ppData\Local\Temp\2\pip-install-vy05tre2\fiona\

I can't find anywhere that the gdal-data directory is located. Given the error log as such 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., how can I go about setting the GDAL_CONFIG environment variable with the Python GDAL library installed through pip3?

Alex R
  • 11,364
  • 15
  • 100
  • 180
alextc
  • 3,206
  • 10
  • 63
  • 107
  • 1
    Since you are downloading wheels from Gohlke's site, I think you better download the binary wheel for Fiona from there as well (which should already be built against the GDAL from there). But more in general, I recommend to use Anaconda to install GeoPandas. – joris Apr 09 '19 at 07:54
  • 2
    Did you solve this? I just successfully installed `fiona` and `geopandas` on Windows 10 and worked through most if not all of the isues you're facing. To start, you aren't going to find a `GDAL_CONFIG` variable as this is specific to Linux, You may need to edit your `PATH` environment variable or add `GDAL_DATA` or `GDAL_VERSION` variables' – Hugh_Kelley Jul 15 '19 at 13:27
  • Same error on Windows 10, Python 3.7. It appears Geopandas dependencies are simply not Windows compatible. See also: https://stackoverflow.com/questions/50876702/cant-install-fiona-on-windows?rq=1, https://stackoverflow.com/questions/53661919/getting-error-code-1-while-installing-geopandas-with-pip?rq=1 – Alex R Sep 16 '19 at 07:11
  • I was only able to install geopandas, fiona with conda and after that I had to set also the following environment variables as a very first step: os.environ['GDAL_DATA'] = os.environ['CONDA_PREFIX'] + r'\Library\share\gdal' os.environ['PROJ_LIB'] = os.environ['CONDA_PREFIX'] + r'\Library\share' and – Bruno Vermeulen Sep 16 '19 at 08:23

1 Answers1

7

The only solution seems to be installing the ready binaries from here ~gohlke

https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

Then, just install the required libraries locally. For me, I did the following in this order (Python 3.8.6)

pip install GDAL-3.1.4-cp38-cp38-win_amd64.whl

pip install Fiona-1.8.18-cp38-cp38-win_amd64.whl

pip install geopandas-0.8.1-py3-none-any.whl

Rami Alloush
  • 2,308
  • 2
  • 27
  • 33