conda-forge / rasterio-feedstock

A conda-smithy repository for rasterio.
BSD 3-Clause "New" or "Revised" License
42 stars 22 forks source link

ImportError: DLL load failed while importing _base: The specified procedure could not be found. #240

Closed jackieleng closed 1 year ago

jackieleng commented 2 years ago

Solution to issue cannot be found in the documentation.

Issue

I try installing rasterio from conda-forge (Windows), but when importing rasterio I get an error. I.e.:

(test) C:\Users\asdf>python -c "import rasterio"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\asdf\Miniconda3\envs\test\lib\site-packages\rasterio\__init__.py", line 9, in <module>
    from rasterio._base import gdal_version
ImportError: DLL load failed while importing _base: The specified procedure could not be found.

Installed packages

# Name                    Version                   Build  Channel
affine                    2.3.1              pyhd8ed1ab_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
blosc                     1.21.0               h0e60522_0    conda-forge
boost-cpp                 1.74.0               h9f4b32c_7    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2021.10.8            h5b45459_0    conda-forge
cairo                     1.16.0            h15b3021_1010    conda-forge
certifi                   2021.10.8       py310h5588dad_1    conda-forge
cfitsio                   4.1.0                h5a969a9_0    conda-forge
click                     8.0.4           py310h5588dad_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
curl                      7.82.0               h789b8ee_0    conda-forge
expat                     2.4.7                h39d44d4_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.13.96              hce3cb01_2    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.10.4               h546665d_1    conda-forge
freexl                    1.0.6                ha8e266a_0    conda-forge
geos                      3.10.2               h39d44d4_0    conda-forge
geotiff                   1.7.0                h38b14a8_7    conda-forge
gettext                   0.19.8.1          ha2e2712_1008    conda-forge
hdf4                      4.2.15               h0e5069d_3    conda-forge
hdf5                      1.12.1          nompi_h57737ce_104    conda-forge
icu                       69.1                 h0e60522_0    conda-forge
intel-openmp              2022.0.0          h57928b3_3663    conda-forge
jbig                      2.1               h8d14728_2003    conda-forge
jpeg                      9e                   h8ffe710_0    conda-forge
kealib                    1.4.14               h8995ca9_3    conda-forge
krb5                      1.19.3               hc8ab02b_0    conda-forge
lcms2                     2.12                 h2a16943_0    conda-forge
lerc                      3.0                  h0e60522_0    conda-forge
libblas                   3.9.0              13_win64_mkl    conda-forge
libcblas                  3.9.0              13_win64_mkl    conda-forge
libcurl                   7.82.0               h789b8ee_0    conda-forge
libdeflate                1.10                 h8ffe710_0    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libgdal                   3.4.2                hf817787_2    conda-forge
libglib                   2.70.2               h3be07f2_4    conda-forge
libiconv                  1.16                 he774522_0    conda-forge
libkml                    1.3.0             h9859afa_1014    conda-forge
liblapack                 3.9.0              13_win64_mkl    conda-forge
libnetcdf                 4.8.1           nompi_h1cc8e9d_101    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libpq                     14.2                 h1ea2d34_0    conda-forge
librttopo                 1.1.0                hb1df466_9    conda-forge
libspatialite             5.0.1               h36c16d9_15    conda-forge
libssh2                   1.10.0               h9a1e1f7_2    conda-forge
libtiff                   4.3.0                hc4061b1_3    conda-forge
libwebp-base              1.2.2                h8ffe710_1    conda-forge
libxml2                   2.9.12               hf5bbc77_1    conda-forge
libzip                    1.8.0                h519de47_1    conda-forge
libzlib                   1.2.11            h8ffe710_1014    conda-forge
lz4-c                     1.9.3                h8ffe710_1    conda-forge
mkl                       2022.0.0           h0e2418a_796    conda-forge
numpy                     1.22.3          py310hcae7c84_0    conda-forge
openjpeg                  2.4.0                hb211442_1    conda-forge
openssl                   3.0.2                h8ffe710_1    conda-forge
pcre                      8.45                 h0e60522_0    conda-forge
pip                       22.0.4             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h8ffe710_0    conda-forge
poppler                   22.01.0              h24fffdf_2    conda-forge
poppler-data              0.4.11               hd8ed1ab_0    conda-forge
postgresql                14.2                 he353ca9_0    conda-forge
proj                      9.0.0                h1cfcee9_1    conda-forge
pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
python                    3.10.4          hcf16a7b_0_cpython    conda-forge
python_abi                3.10                    2_cp310    conda-forge
rasterio                  1.2.10          py310h41cc0dd_5    conda-forge
setuptools                61.1.1          py310h5588dad_0    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sqlite                    3.37.1               h8ffe710_0    conda-forge
tbb                       2021.5.0             h2d74725_0    conda-forge
tiledb                    2.7.1                h47404fa_0    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
tzdata                    2022a                h191b570_0    conda-forge
ucrt                      10.0.20348.0         h57928b3_0    conda-forge
vc                        14.2                 hb210afc_6    conda-forge
vs2015_runtime            14.29.30037          h902a5da_6    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.3                h0e60522_4    conda-forge
xz                        5.2.5                h62dcd97_1    conda-forge
zlib                      1.2.11            h8ffe710_1014    conda-forge
zstd                      1.5.2                h6255e5f_0    conda-forge

Environment info

active environment : test
    active env location : C:\Users\asdf\Miniconda3\envs\test
            shell level : 2
       user config file : C:\Users\asdf\.condarc
 populated config files : C:\Users\asdf\.condarc
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.9.10.final.0
       virtual packages : __cuda=11.4=0
                          __win=0=0
                          __archspec=1=x86_64
       base environment : C:\Users\jackie\Miniconda3  (writable)
      conda av data dir : C:\Users\jackie\Miniconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\asdf\Miniconda3\pkgs
                          C:\Users\asdf\.conda\pkgs
                          C:\Users\asdf\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\asdf\Miniconda3\envs
                          C:\Users\asdf\.conda\envs
                          C:\Users\asdf\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.9.10 Windows/10 Windows/10.0.19044
          administrator : False
             netrc file : None
           offline mode : False
akrherz commented 2 years ago

Related Toblerity/Fiona#944 conda-forge/fiona-feedstock#192

yucsong commented 2 years ago

This issue has been going on forever, can some fix it?

ocefpaf commented 2 years ago

This issue has been going on forever, can some fix it?

If you know how to and have Windows skill, please do! Otherwise, you should know that the volunteers here are overwhelmed with tons of requests and they 0 pay they get makes this a really low priority.

JKrinkels commented 2 years ago

Is anyone aware of any robust workarounds?

pwernette commented 1 year ago

Still having this issue. import rasterio appears to work for me in a jupyter notebook but not in a standalone Python script. Tried re-installing GDAL using a wheel file (from https://www.lfd.uci.edu/~gohlke/pythonlibs/) but still get the error described here.

JKrinkels commented 1 year ago

It is solved for me using:

both from https://www.lfd.uci.edu/~gohlke/pythonlibs/

AlirezaKavousi commented 1 year ago

It solved for me by adding directories of "gdal.dll" file and "gdaldata" floder to the Windows PATH Directory, as it was suggested as a note in https://rasterio.readthedocs.io/en/latest/installation.html

jdilger commented 1 year ago

It seems like the issue is somewhere in rasterio's 1.3.2 build. If anyone is looking for a conda alternative to the wheels you can install rasterio 1.2.10 via conda and it appears to work fine. conda install "rasterio=1.2.10"

Samlewis99 commented 1 year ago

2nd this issue

ocefpaf commented 1 year ago

There is a not of confusing in this issue. I just tested a fresh env, with only conda-forge in the channel list as stated in our docs, and everything worked.

conda create --name TEST rasterio
conda activate TEST
python -c "import rasterio"

and here is my .condarc for reference. Note that only the strict channel option and the conda-forge channel in the list are required, everything else is optional and this also works with or without them.

show_channel_urls: true
add_pip_as_python_dependency: false
channel_priority: strict
channels:
  - conda-forge
safety_checks: disabled
auto_update_conda: false
experimental_solver: libmamba

I'm closing and locking this issue. If you are still experiencing this please open a new one with the required debug information so we can do something. +1 ones here won't help b/c we don't know each of your personal config or install attempts.

PS: some of you here seems to be mixing non official pip DLLs with conda packages, that won't work!