[GIS] How to fix python ImportError: DLL load failed: The specified module could not be found

fionaimporterrorinstallationpyqgis

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.

Best Answer

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.

Related Question