简体   繁体   中英

Fixing "DLL load failed: The specified module could not be found." error in python for importing rasterio

I am trying to download the package rasterio for analyzing raster datasets in python within the geospatial analysis disciplines.

I have downloaded the package dependencies for rasterio, including gdal , pyproj , and fiona via the wheel files from this geospatial analysis binaries resource: https://www.lfd.uci.edu/~gohlke/pythonlibs/

I installed these packages through pip .

I then downloaded from this resource the wheel file rasterio through pip .

I received the following message from Window Command Prompt after installing rasterio : Successfully installed affine-2.3.0 numpy-1.21.4 pyparsing-3.0.6 rasterio-1.2.10 snuggs-1.4.7 .

I want to use this package in Jupyter Notebook , and so I open a Jupyter Notebook file and run import rasterio , and receive this error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-17-350e27267e59> in <module>
----> 1 import rasterio

~\Anaconda3\lib\site-packages\rasterio\__init__.py in <module>
     15 from pathlib import Path
     16 
---> 17 from rasterio._base import gdal_version
     18 from rasterio.drivers import driver_from_extension, is_blacklisted
     19 from rasterio.dtypes import (

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

How can I address this "DLL load failed" issue and address this error so that I can use rasterio ? I was told this could be an issue of not having Visual C++ installed on my computer, and so I installed Visual Studio 2022 on my computer, but this did not help.

I solved this problem with the following steps:

  1. I created a fresh environment

  2. I installed the gdal library (since rasterio is built on top of it), with the command:

    conda install -c conda-forge gdal

  3. I installed rasterio with the command:

    conda install -c conda-forge rasterio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM