When I am importing RASTERIO
then i am getting an error as:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import rasterio
File "C:\Python27\lib\site-packages\rasterio\__init__.py", line 17, in <module>
from rasterio._base import eval_window, window_shape, window_index
ImportError: DLL load failed: The specified module could not be found.
On importing FIONA i am getting error as:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import fiona
File "C:\Python27\lib\site-packages\fiona\__init__.py", line 78, in <module>
from fiona.collection import Collection, BytesCollection, vsi_path
File "C:\Python27\lib\site-packages\fiona\collection.py", line 7, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
ImportError: DLL load failed: The specified module could not be found.
While both rasterio
and fiona
installed successfully by pip install. please help some one i am stucked here.i am using python 2.7 and gdal1.10 and numpy1.10.2 on 32 bit
3 Answers 3
In Windows, you cannot install rasterio an fiona wit pip
, why ?
Because they need the compilation of many C libraries and Windows has no compiler by default as in Linux or Mac OS X (see How can I install pyproj into arcpy?)
Therefore you can't install these module with setuptools , easy_install or pip -> DLL load failed: The specified module could not be found
.
Use the Christoph Gohlke's compiled versions fiona and rasterio
-
Can be done with pip if the MS Visual C++ compiler for python is installed, but installing via Christoph Gohlke's versions is definitely easier.user2856– user28562016年03月11日 11:00:51 +00:00Commented Mar 11, 2016 at 11:00
-
1i have installed MS visual C++ compiler for python even then i am getting same error. now i extracted pypi rasterio tar file as rasterio-0.27.0 and when i am installing it by python setup.py install then it is giving error as -rasterio/_base.c(263): fatal error c1083: canot open include : cpl_conv.h':no such file or directory and cl.exe failed with exit status 2vishal srivastava– vishal srivastava2016年03月11日 16:34:08 +00:00Commented Mar 11, 2016 at 16:34
-
Have you installed the GAL/OGR Python module because cpl_conv.h is part of GDALgene– gene2016年03月12日 10:33:38 +00:00Commented Mar 12, 2016 at 10:33
-
yes i have installed gdal ogr via exe file. i resolved cpl_conv.h( and other header file problem) by copying required header file in microsoft visual C++ for python's include folder but now after cl.exe got all the header files i got a new problem thatis- link .exe failed with exit status 1120. and fatal error LINK1120: 42 unresolved externalsvishal srivastava– vishal srivastava2016年03月13日 08:30:04 +00:00Commented Mar 13, 2016 at 8:30
-
Sorry but I don't work on Windows and I cannot help yougene– gene2016年03月13日 09:37:15 +00:00Commented Mar 13, 2016 at 9:37
I'd say gene's answer works for the vast majority of the cases and I use Gohlke's wheel files quite often. However, if you have a custom GDAL (or are just really set on doing it yourself), and you've got the MS C++ compiler, you can build rasterio from source on Windows.
One thing that might be hanging you up is that you'll probably need to specify a couple extra options in the setup.cfg
file. I did this:
[build_ext]
include_dirs=C:\path\to\gdal\include\dir
library_dirs=C:\path\to\gdal\lib\dir
libraries=gdal_i
Once you've done that, you should be able to run python setup.py bdist_wheel
and then you'll have a wheel file in the dist
directory. From there, you can pip install C:\path\to\wheel\file.whl
.
You can download rasterio, fiona and GDAL wheel file based on your python version from https://www.lfd.uci.edu/~gohlke/pythonlibs/. Please uninstall another GDAL version if available. Then use pip to install GDAL, rasterio and fiona respectively.