I have Anaconda Python 3.6 on Windows 7. I frequently use GeoPandas and it worked fine. Yesterday I tried to install rasterio and georasters, and they seemed to install fine using the suggested method
conda config --add channels conda-forge
conda install rasterio
Then installed georasters using
conda install -c conda-forge georasters
And got a successfull installation message. When trying to import them they do not work - there is an error message on import rasterio
or import georasters
. Digging into it, I found geopandas, fiona and GDAL were now also broken and after 1hr trying uninstalling/ installing packages with conda I'm not sure what is the problem and solution. The root problem seems to be GDAL, but I'm not sure.
Importing GDAL gives the following error message
>>> import gdal
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python36_Anaconda3\lib\site-packages\gdal.py", line 2, in <module>
from osgeo.gdal import deprecation_warn
File "C:\Python36_Anaconda3\lib\site-packages\osgeo\__init__.py", line 25, in
<module>
_gdal = swig_import_helper()
File "C:\Python36_Anaconda3\lib\site-packages\osgeo\__init__.py", line 21, in
swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
File "C:\Python36_Anaconda3\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Python36_Anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Does anybody know a fix or how to reinstall these packages cleanly?
Starting with the python environment that works fine, and installing the packages with the flag --no-update-dependencies
allowed the packages to get installed and work with no problems. They may not be the most up to date versions, but they work.
conda install rasterio --no-update-dependencies
conda install georasters --no-update-dependencies
This may also be a solution for anyone trying to install packages that break your python environment.
来源:https://stackoverflow.com/questions/51959128/installation-of-gdal-with-conda-on-windows