4

During import fiona, I am getting following error. Error is different from other user so I asked this question may be it is repeated.

import fiona

Traceback (most recent call last):

File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import mod = _builtin_import(name, globals, locals, fromlist, level)

File "D:\PROGRA~1\Quantum GIS Lisboa\apps\Python27\lib\site-packages\fiona__init__.py", line 79, in from fiona.collection import Collection, supported_drivers, vsi_path

File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import mod = _builtin_import(name, globals, locals, fromlist, level)

File "D:\PROGRA~1\Quantum GIS Lisboa\apps\Python27\lib\site-packages\fiona\collection.py", line 7, in from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

File "D:/PROGRA~1/Quantum GIS Lisboa/apps/qgis/./python\qgis\utils.py", line 309, in _import mod = _builtin_import(name, globals, locals, fromlist, level)

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

4
  • 1
    I think Fiona (and Shapely) both require GDAL installed. Have you also installed this?
    – Joseph
    Commented Nov 6, 2014 at 11:55
  • 2
    A tool often used at StackOverflow to find missing dependencies (dll's, etc.) is dependencywalker.com. Maybe try this first to see which DLL is missing.
    – Kersten
    Commented Nov 6, 2014 at 12:27
  • 1
    Seeing the QGIS import machinery at work tells me that you're trying to use a plugin that depends on Fiona, right? You really ought to spell this out in your question so that people don't have to do unnecessary detective work to help you. Joseph above is right, this is a case of the GDAL DLL not being found. Hopefully the developer of the plugin will see your question and help you out.
    – sgillies
    Commented Nov 6, 2014 at 16:35
  • Yes. I already installed both GDAL.
    – Bharat
    Commented Nov 6, 2014 at 17:08

2 Answers 2

5

When you read Python Package Index: Fiona

Fiona requires Python 2.6, 2.7, 3.3, or 3.4 and GDAL/OGR 1.8+. To build from a source distribution you will need a C compiler and GDAL and Python development headers and libraries (libgdal1-dev for Debian/Ubuntu, gdal-dev for CentOS/Fedora).

What does it mean ?

That Fiona is not a pure Python module and needs to be compiled from the C/C++ libraries of GDAL and other requirements installed.

As there is no native compiler on Windows:

Windows Binary installers are available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona http://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona and coming eventually to PyPI.

Therefore, you need to install:

  1. first the gdal (osgeo) module of Christoph Gohlke
  2. then his Fiona version, compiled for the libraries of 1)

But, there is a problem since you are using the Python version of QGIS. There is already an osgeo module installed and used by QGIS (in D:\PROGRA~1\Quantum GIS Lisboa\apps\Python27\lib\site-packages\osgeo). I am not on Windows, so I do not know if you can replace it with the Christoph Gohlke's version (try Dependency Walker as Kersten says)

But why install Fiona in the Python version of QGIS, while there is PyQGIS ? Fiona has been made to work in pure Python.

2
  • Gene, I too suspect that Fiona and QGIS can't be mixed on Windows due to the extra osgeo.gdal dependency. Would be nice if somebody conclusively answered this category of question because it comes up regularly.
    – sgillies
    Commented Nov 7, 2014 at 0:19
  • This worked for me to get fiona working on windows. I did have to use --upgrade when installing gdal and fiona from step 1 and 2. Commented Feb 29, 2016 at 20:49
1

I had a similar problem running anaconda/spyder on a windows machine and it turned out to be an issue with a Microsoft patch that was not installed which is required by gdal.

I was not able to import gdal and fiona until I downloaded the correct patch (I am on a 64-bit windows 7 system and the x84 version would not work for me. It was downloaded by my network admin, so I had to remove it and install the correct x64 version, so do be careful to get the correct version for your system. After that I removed and re-installed gdal and fiona with pip.

https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/cGhArND_2T8

Here is the link to the patch:

http://www.microsoft.com/en-us/download/details.aspx?id=26368

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.