fiona import issues in python

Python Spark picture Python Spark · Jun 13, 2018 · Viewed 8.3k times · Source

i have installed fiona using whl distributions.. but while importing i am getting following error :

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-b0161244e1be> in <module>()
----> 1 import fiona
      2 with fiona.open(r'C:\Users\harish.padi\Downloads\BSP\BSP\BSP_default_pred.shp', 'r') as input:
      3     with open(r'C:\Users\harish.padi\Downloads\BSP\BSP\output.txt', 'w') as output:
      4        for pt in input:
      5            id = pt['properties']['id']

c:\program files\python36\lib\site-packages\fiona\__init__.py in <module>()
     75     pass
     76 
---> 77 from fiona.collection import Collection, BytesCollection, vsi_path
     78 from fiona._drivers import driver_count, GDALEnv
     79 from fiona.drvsupport import supported_drivers

c:\program files\python36\lib\site-packages\fiona\collection.py in <module>()
      7 
      8 from fiona import compat
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
     10 from fiona.ogrext import Session, WritingSession
     11 from fiona.ogrext import (

ImportError: DLL load failed: The specified module could not be found.

can anyone suggest a solution.?

Answer

ermaure picture ermaure · Jun 20, 2019

Maybe is better to mention that GDAL 2.2.4 is for Python 2.7 (as in the link provided).

I was having the same ImportError issue with Python 3.7, Fiona 1.8.6 and GDAL 3.0.0

By replacing GDAL 3.0.0 with 2.2.4 I got it working, without consideration of the other details