2

I am on Windows and using Python via Anaconda.

Python 3.8.8, 64 bit AMD64

  1. I downloaded the gdal & fiona wheels from
    https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
    https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona

GDAL-3.2.3-cp38-cp38-win_amd64.whl
Fiona-1.8.20-cp38-cp38-win_amd64.whl

  1. Installed gdal successfully: Version 3.2.3

  2. Add Environment Variable with the name GDAL_DATA and value =

C:\Users\yourUserName\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\osgeo\data\gdal

  1. Installed Visual C++ build tools from https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. Re-start my computer

  3. pip install C:/Users/Asus/anaconda3/Lib/Fiona-1.8.20-cp38-cp38-win_amd64.whl

But there is always error in building gdal wheel at step 6.

Using cached gdal 3.3.1.tar.gz .....

Failed in building wheels for gdal ...

Why is there a need for fiona to build wheels for gdal when I have already installed gdal? I have added the path for the installed gdal to environment variable.

Peter
  • 353
  • 3
  • 10

2 Answers2

3

I was trying to read a .shp file using gpd.read_file,

shapefile = gpd.read_file(r'C:\Users\abhir....\shapefiles\louisville.shp')

which threw an ImportError

ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: DLL load failed while importing ogrext: The specified procedure could not be found.

Apparantly, I was using different versions of GDAL and fiona combinations.

GDAL-3.3.2-cp38-cp38-win_amd64.whl

Fiona-1.8.20-cp38-cp38-win_amd64.whl

I had to uninstall the above versions and install the below versions. It resolved the issue.

GDAL-3.2.3-cp38-cp38-win_amd64.whl

Fiona‑1.8.19‑cp38‑cp38‑win_amd64.whl

Abhiram
  • 498
  • 2
  • 3
  • 11
  • GDal 3.2.3 does not even exist. See the [releases](https://github.com/OSGeo/gdal/releases?page=1). However, Fiona 1.8.19 and GDal 3.2.2 appear to be compatible. – Alex Jan 18 '22 at 08:24
1

I have to use

Fiona‑1.8.19‑cp38‑cp38‑win_amd64.whl

Peter
  • 353
  • 3
  • 10
  • 1
    Please add further details to expand on your answer, such as working code or documentation citations. – Community Aug 29 '21 at 17:38