Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLL Import error after update #270

Closed
kmilos opened this issue Apr 6, 2021 · 13 comments
Closed

DLL Import error after update #270

kmilos opened this issue Apr 6, 2021 · 13 comments

Comments

@kmilos
Copy link

kmilos commented Apr 6, 2021

After the recent update on import cv2 I'm now getting on Windows: ImportError: DLL load failed: The specified procedure could not be found.

C:\> conda list opencv
# packages in environment at C:\Users\kmilos\.conda\envs\dev:
#
# Name                    Version                   Build  Channel
libopencv                 4.5.1            py37h9d0389d_1    conda-forge
opencv                    4.5.1            py37h03978a9_1    conda-forge
py-opencv                 4.5.1            py37h7813e69_1    conda-forge

C:\> conda list libprotobuf
# packages in environment at C:\Users\kmilos\.conda\envs\dev:
#
# Name                    Version                   Build  Channel
libprotobuf               3.15.7               h7755175_0    conda-forge

No problem if I downgrade conda install py-opencv=4.5.1=py37heaed05f_0

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 6, 2021

can you provide the full output of conda-list? that will give us a good reference to compare against when we trigger a build on the CI-s

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 6, 2021

I just asked the bots to rerun the pypy37 builds, so we should have a fresh set of builds within a few hours.

@kmilos
Copy link
Author

kmilos commented Apr 6, 2021

Sure, here goes:

conda list
# packages in environment at C:\Users\kmilos\.conda\envs\dev:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                     py_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
arrow                     1.0.3            py37h03978a9_0    conda-forge
astroid                   2.5.2            py37h03978a9_0    conda-forge
async_generator           1.10                       py_0    conda-forge
atomicwrites              1.4.0              pyh9f0ad1d_0    conda-forge
attrs                     20.3.0             pyhd3deb0d_0    conda-forge
autopep8                  1.5.6              pyhd8ed1ab_0    conda-forge
babel                     2.9.0              pyhd3deb0d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.3              pyhd8ed1ab_0    conda-forge
bcrypt                    3.2.0            py37hcc03f2d_1    conda-forge
binaryornot               0.4.4                      py_1    conda-forge
black                     20.8b1                     py_1    conda-forge
bleach                    3.3.0              pyh44b312d_0    conda-forge
blosc                     1.21.0               h0e60522_0    conda-forge
brotli                    1.0.9                h0e60522_4    conda-forge
brotlipy                  0.7.0           py37hcc03f2d_1001    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2020.12.5            h5b45459_0    conda-forge
certifi                   2020.12.5        py37h03978a9_1    conda-forge
cffi                      1.14.5           py37hd8e9650_0    conda-forge
chardet                   4.0.0            py37h03978a9_1    conda-forge
charls                    2.2.0                h39d44d4_0    conda-forge
click                     7.1.2              pyh9f0ad1d_0    conda-forge
cloudpickle               1.6.0                      py_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
colour-science            0.3.16             pyh44b312d_1    conda-forge
cookiecutter              1.7.2              pyh9f0ad1d_0    conda-forge
cryptography              3.4.7            py37h20c650d_0    conda-forge
cycler                    0.10.0                     py_2    conda-forge
dataclasses               0.8                pyhc8e2a94_1    conda-forge
decorator                 5.0.5              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
diff-match-patch          20200713           pyh9f0ad1d_0    conda-forge
docutils                  0.17             py37h03978a9_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
flake8                    3.8.4                      py_0    conda-forge
freeglut                  3.2.1                h0e60522_2    conda-forge
freeimage                 3.18.0               hb49e22e_7    conda-forge
freetype                  2.10.4               h546665d_1    conda-forge
future                    0.18.2           py37h03978a9_3    conda-forge
giflib                    5.2.1                h8d14728_2    conda-forge
icu                       68.1                 h0e60522_0    conda-forge
idna                      2.10               pyh9f0ad1d_0    conda-forge
ilmbase                   2.5.5                h12d4b20_0    conda-forge
imagecodecs               2021.3.31        py37hc6c0c29_0    conda-forge
imageio                   2.9.0                      py_0    conda-forge
imagesize                 1.2.0                      py_0    conda-forge
importlib-metadata        3.10.0           py37h03978a9_0    conda-forge
importlib_metadata        3.10.0               hd8ed1ab_0    conda-forge
inflection                0.5.1              pyh9f0ad1d_0    conda-forge
intel-openmp              2021.2.0           h57928b3_616    conda-forge
intervaltree              3.0.2                      py_0    conda-forge
ipykernel                 5.5.3            py37h7813e69_0    conda-forge
ipython                   7.22.0           py37h7813e69_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isort                     5.8.0              pyhd8ed1ab_0    conda-forge
jasper                    2.0.14               h77af90b_2    conda-forge
jedi                      0.17.2           py37h03978a9_1    conda-forge
jinja2                    2.11.3             pyh44b312d_0    conda-forge
jinja2-time               0.2.0                      py_2    conda-forge
jpeg                      9d                   h8ffe710_0    conda-forge
jsonschema                3.2.0              pyhd8ed1ab_3    conda-forge
jupyter_client            6.1.12             pyhd8ed1ab_0    conda-forge
jupyter_core              4.7.1            py37h03978a9_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jxrlib                    1.1                  h8ffe710_2    conda-forge
keyring                   23.0.1           py37h03978a9_0    conda-forge
kiwisolver                1.3.1            py37h8c56517_1    conda-forge
lazy-object-proxy         1.6.0            py37hcc03f2d_0    conda-forge
lcms2                     2.12                 h2a16943_0    conda-forge
lerc                      2.2.1                h0e60522_0    conda-forge
libaec                    1.0.4                h39d44d4_1    conda-forge
libblas                   3.9.0                     8_mkl    conda-forge
libcblas                  3.9.0                     8_mkl    conda-forge
libclang                  11.1.0          default_h5c34c98_0    conda-forge
libdeflate                1.7                  h8ffe710_5    conda-forge
liblapack                 3.9.0                     8_mkl    conda-forge
liblapacke                3.9.0                     8_mkl    conda-forge
libopencv                 4.5.1            py37h9d0389d_1    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libprotobuf               3.15.7               h7755175_0    conda-forge
libraw                    0.20.2               hee1bdec_1    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libspatialindex           1.9.3                h39d44d4_3    conda-forge
libtiff                   4.2.0                hc10be44_0    conda-forge
libwebp-base              1.2.0                h8ffe710_2    conda-forge
libzopfli                 1.0.3                h0e60522_0    conda-forge
llvmlite                  0.36.0           py37habb0c8c_0    conda-forge
lz4-c                     1.9.3                h8ffe710_0    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
markupsafe                1.1.1            py37hcc03f2d_3    conda-forge
matplotlib                3.4.1            py37h03978a9_0    conda-forge
matplotlib-base           3.4.1            py37h0d1fb12_0    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mistune                   0.8.4           py37hcc03f2d_1003    conda-forge
mkl                       2020.4             hb70f87d_311    conda-forge
mkl-service               2.3.0            py37h4ab8f01_2    conda-forge
mkl_fft                   1.3.0            py37hda49f71_1    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
mypy_extensions           0.4.3            py37h03978a9_3    conda-forge
nbclient                  0.5.3              pyhd8ed1ab_0    conda-forge
nbconvert                 6.0.7            py37h03978a9_3    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
numba                     0.53.1           py37h4e635f9_0    conda-forge
numpy                     1.20.2           py37hcbcd69c_0    conda-forge
numpydoc                  1.1.0                      py_1    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
opencv                    4.5.1            py37h03978a9_1    conda-forge
openexr                   2.5.5                hab3b255_0    conda-forge
openjpeg                  2.4.0                h48faf41_0    conda-forge
openssl                   1.1.1k               h8ffe710_0    conda-forge
packaging                 20.9               pyh44b312d_0    conda-forge
pandoc                    2.13                 h8ffe710_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
paramiko                  2.7.2              pyh9f0ad1d_0    conda-forge
parso                     0.7.0              pyh9f0ad1d_0    conda-forge
pathspec                  0.8.1              pyhd3deb0d_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    8.1.2            py37h96663a1_0    conda-forge
pip                       21.0.1             pyhd8ed1ab_0    conda-forge
pluggy                    0.13.1           py37h03978a9_4    conda-forge
poyo                      0.5.0                      py_0    conda-forge
prompt-toolkit            3.0.18             pyha770c72_0    conda-forge
psutil                    5.8.0            py37hcc03f2d_1    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
py-opencv                 4.5.1            py37h7813e69_1    conda-forge
pycodestyle               2.6.0              pyh9f0ad1d_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pydocstyle                6.0.0              pyhd8ed1ab_0    conda-forge
pyflakes                  2.2.0              pyh9f0ad1d_0    conda-forge
pygments                  2.8.1              pyhd8ed1ab_0    conda-forge
pylint                    2.7.2            py37h03978a9_0    conda-forge
pyls-black                0.4.6              pyh9f0ad1d_0    conda-forge
pyls-spyder               0.3.2              pyhd8ed1ab_0    conda-forge
pynacl                    1.4.0            py37ha54c9ec_2    conda-forge
pyopenssl                 20.0.1             pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.12.3           py37h03978a9_7    conda-forge
pyqt-impl                 5.12.3           py37hf2a7229_7    conda-forge
pyqt5-sip                 4.19.18          py37hf2a7229_7    conda-forge
pyqtchart                 5.12             py37hf2a7229_7    conda-forge
pyqtwebengine             5.12.1           py37hf2a7229_7    conda-forge
pyrsistent                0.17.3           py37hcc03f2d_2    conda-forge
pysocks                   1.7.1            py37h03978a9_3    conda-forge
python                    3.7.10          h7840368_100_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python-jsonrpc-server     0.4.0              pyh9f0ad1d_0    conda-forge
python-language-server    0.36.2             pyhd8ed1ab_0    conda-forge
python-slugify            4.0.1              pyh9f0ad1d_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
pywin32                   300              py37hcc03f2d_0    conda-forge
pywin32-ctypes            0.2.0           py37h03978a9_1003    conda-forge
pyyaml                    5.4.1            py37hcc03f2d_0    conda-forge
pyzmq                     22.0.3           py37hcce574b_1    conda-forge
qdarkstyle                3.0.2              pyhd8ed1ab_0    conda-forge
qstylizer                 0.1.10             pyhd8ed1ab_0    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
qtawesome                 1.0.2              pyhd8ed1ab_0    conda-forge
qtconsole                 5.0.3              pyhd8ed1ab_0    conda-forge
qtpy                      1.9.0                      py_0    conda-forge
quaternion                2021.4.5.14.42.35  py37hcc03f2d_0    conda-forge
rawpy                     0.16.0                   pypi_0    pypi
regex                     2021.4.4         py37hcc03f2d_0    conda-forge
requests                  2.25.1             pyhd3deb0d_0    conda-forge
rope                      0.18.0             pyh9f0ad1d_0    conda-forge
rtree                     0.9.7            py37h13cc57e_1    conda-forge
scipy                     1.6.2            py37h924764e_0    conda-forge
setuptools                50.0.0           py37hc8dfbb8_0    conda-forge
six                       1.15.0             pyh9f0ad1d_0    conda-forge
snappy                    1.1.8                ha925a31_3    conda-forge
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.3.0              pyhd8ed1ab_0    conda-forge
sphinx                    3.5.3              pyhd8ed1ab_0    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    1.0.3                      py_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.4                      py_0    conda-forge
spyder                    5.0.0            py37h03978a9_0    conda-forge
spyder-kernels            2.0.1            py37h03978a9_0    conda-forge
sqlite                    3.35.4               h8ffe710_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
text-unidecode            1.3                        py_0    conda-forge
textdistance              4.2.1              pyhd8ed1ab_0    conda-forge
three-merge               0.1.1              pyh9f0ad1d_0    conda-forge
tifffile                  2021.3.17          pyhd8ed1ab_0    conda-forge
tinycss                   0.4             pyhd8ed1ab_1002    conda-forge
tk                        8.6.10               h8ffe710_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tornado                   6.1              py37hcc03f2d_1    conda-forge
traitlets                 5.0.5                      py_0    conda-forge
typed-ast                 1.4.2            py37hcc03f2d_0    conda-forge
typing_extensions         3.7.4.3                    py_0    conda-forge
ujson                     4.0.2            py37hf2a7229_0    conda-forge
unidecode                 1.2.0              pyhd8ed1ab_0    conda-forge
urllib3                   1.26.4             pyhd8ed1ab_0    conda-forge
vc                        14.2                 hb210afc_4    conda-forge
vs2015_runtime            14.28.29325          h5e1d092_4    conda-forge
watchdog                  1.0.2            py37h03978a9_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
whichcraft                0.6.1                      py_0    conda-forge
win_inet_pton             1.1.0            py37h03978a9_2    conda-forge
wincertstore              0.2             py37h03978a9_1006    conda-forge
wrapt                     1.12.1           py37hcc03f2d_3    conda-forge
xz                        5.2.5                h62dcd97_1    conda-forge
yaml                      0.2.5                he774522_0    conda-forge
yapf                      0.30.0             pyh9f0ad1d_0    conda-forge
zeromq                    4.3.4                h0e60522_0    conda-forge
zfp                       0.5.5                h0e60522_5    conda-forge
zipp                      3.4.1              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11            h62dcd97_1010    conda-forge
zstd                      1.4.9                h6255e5f_0    conda-forge

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 6, 2021

Great, we should be able to see the error on the CI soon then.

@kmilos
Copy link
Author

kmilos commented Apr 6, 2021

I get the same error if I downgrade conda install libprotobuf=3.15.6

@mshabunin
Copy link
Contributor

Can not reproduce on Windows with same packages:

(opencv) >conda list opencv
# packages in environment at C:\envs\opencv:
#
# Name                    Version                   Build  Channel
libopencv                 4.5.1            py37h9d0389d_1    conda-forge
opencv                    4.5.1            py37h03978a9_1    conda-forge
py-opencv                 4.5.1            py37h7813e69_1    conda-forge

(opencv) >conda list protobuf
# packages in environment at C:\envs\opencv:
#
# Name                    Version                   Build  Channel
libprotobuf               3.15.7               h7755175_0    conda-forge

(opencv) >python -c "import cv2; print(cv2.__file__)"
C:\envs\opencv\lib\site-packages\cv2.cp37-win_amd64.pyd

And with downgraded protobuf:

(opencv) >conda list protobuf
# packages in environment at C:\envs\opencv:
#
# Name                    Version                   Build  Channel
libprotobuf               3.15.6               h7755175_0    conda-forge

(opencv) >python -c "import cv2; print(cv2.__file__)"
C:\envs\opencv\lib\site-packages\cv2.cp37-win_amd64.pyd

Make sure you do not have other OpenCV copies installed, e.g. from pip or OpenVINO.

# packages in environment at C:\envs\opencv:
#
# Name                    Version                   Build  Channel
ca-certificates           2020.12.5            h5b45459_0    conda-forge
certifi                   2020.12.5        py37h03978a9_1    conda-forge
freeglut                  3.2.1                h0e60522_2    conda-forge
freetype                  2.10.4               h546665d_1    conda-forge
icu                       68.1                 h0e60522_0    conda-forge
intel-openmp              2021.2.0           h57928b3_616    conda-forge
jasper                    2.0.14               h77af90b_2    conda-forge
jpeg                      9d                   h8ffe710_0    conda-forge
libblas                   3.9.0                     8_mkl    conda-forge
libcblas                  3.9.0                     8_mkl    conda-forge
libclang                  11.1.0          default_h5c34c98_0    conda-forge
liblapack                 3.9.0                     8_mkl    conda-forge
liblapacke                3.9.0                     8_mkl    conda-forge
libopencv                 4.5.1            py37h9d0389d_1    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libprotobuf               3.15.7               h7755175_0    conda-forge
libtiff                   4.2.0                hc10be44_0    conda-forge
libwebp-base              1.2.0                h8ffe710_2    conda-forge
lz4-c                     1.9.3                h8ffe710_0    conda-forge
mkl                       2020.4             hb70f87d_311    conda-forge
numpy                     1.20.2           py37hcbcd69c_0    conda-forge
opencv                    4.5.1            py37h03978a9_1    conda-forge
openssl                   1.1.1k               h8ffe710_0    conda-forge
pip                       21.0.1             pyhd8ed1ab_0    conda-forge
py-opencv                 4.5.1            py37h7813e69_1    conda-forge
python                    3.7.10          h7840368_100_cpython    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
setuptools                49.6.0           py37h03978a9_3    conda-forge
sqlite                    3.35.4               h8ffe710_0    conda-forge
vc                        14.2                 hb210afc_4    conda-forge
vs2015_runtime            14.28.29325          h5e1d092_4    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
wincertstore              0.2             py37h03978a9_1006    conda-forge
xz                        5.2.5                h62dcd97_1    conda-forge
zlib                      1.2.11            h62dcd97_1010    conda-forge
zstd                      1.4.9                h6255e5f_0    conda-forge

@kmilos
Copy link
Author

kmilos commented Apr 6, 2021

Thanks. Something weird is going on, as it does indeed work on another Windows box. I'll try to figure out the difference...

@kmilos
Copy link
Author

kmilos commented Apr 7, 2021

Ah, I have a very old (2.6.1) C:\Windows\System32\libprotobuf.dll that seems to be creating the issue; once I temporarily rename it, the cv2 module loads.

Now, why this one comes up before in the load order, I have no clue - in my PATH of the conda activate dev environment I have C:\Users\kmilos\.conda\envs\dev\Library\bin first:

(dev) PS C:\Users\kmilos> $env:path -split ";"
C:\Users\kmilos\.conda\envs\dev
C:\Users\kmilos\.conda\envs\dev\Library\mingw-w64\bin
C:\Users\kmilos\.conda\envs\dev\Library\usr\bin
C:\Users\kmilos\.conda\envs\dev\Library\bin
C:\Users\kmilos\.conda\envs\dev\Scripts
C:\Users\kmilos\.conda\envs\dev\bin
C:\ProgramData\Anaconda3\condabin
C:\Program Files\ImageMagick-7.0.10-Q16-HDRI
C:\WINDOWS\system32
...

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 7, 2021

Ouch

@kmilos
Copy link
Author

kmilos commented Apr 7, 2021

To make this DLL Hell deserving of its name, it looks like this always the case, unless one takes full, explicit control of library loading:

https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications

@hmaarrfk
Copy link
Contributor

hmaarrfk commented Apr 9, 2021

Did you figure out what application put the dll there?

@kmilos
Copy link
Author

kmilos commented Apr 9, 2021

No app complained since I renamed the dll, but I haven't tested extensively...

Closing for now, don't think there is anything conda-forge can do to work around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants