conda-forge / opencv-feedstock

A conda-smithy repository for opencv.
BSD 3-Clause "New" or "Revised" License
65 stars 60 forks source link

Mismatched openh264 version with opencv for python 3.8 #297

Closed xinpingwang closed 2 years ago

xinpingwang commented 2 years ago

Issue: when import cv2, the following error occurs:

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/Abc/.local/lib/conda/ml/lib/python3.8/site-packages/cv2.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libopenh264.5.dylib
  Referenced from: /Users/Abc/.local/lib/conda/ml/lib/libavcodec.58.91.100.dylib
  Reason: tried: '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/python3.8/site-packages/../../libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/python3.8/site-packages/../../libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/bin/../lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/lib/libopenh264.5.dylib' (no such file), '/Users/Abc/.local/lib/conda/ml/bin/../lib/libopenh264.5.dylib' (no such file), '/usr/local/lib/libopenh264.5.dylib' (no such file), '/usr/lib/libopenh264.5.dylib' (no such file)

After checking the files in /Users/Abc/.local/lib/conda/ml/lib/, there is libopenh264.6.dylib, other than libopenh264.5.dylib

 ➜  lib ls | grep libopenh264
libopenh264.2.1.1.dylib
libopenh264.6.dylib
libopenh264.a
libopenh264.dylib

create a linked file libopenh264.5.dylib target to libopenh264.2.1.1.dylib would fix the issue.

ln -s libopenh264.2.1.1.dylib libopenh264.5.dylib


Environment (conda list):

``` $ conda list # packages in environment at /Users/Abc/.local/lib/conda/ml: # # Name Version Build Channel abseil-cpp 20210324.2 he49afe7_0 conda-forge absl-py 0.15.0 pyhd8ed1ab_0 conda-forge aiohttp 3.8.1 py38h96a0964_0 conda-forge aiosignal 1.2.0 pyhd8ed1ab_0 conda-forge anyio 3.5.0 py38h50d1736_0 conda-forge appdirs 1.4.4 pyh9f0ad1d_0 conda-forge appnope 0.1.2 py38h50d1736_2 conda-forge argon2-cffi 21.3.0 pyhd8ed1ab_0 conda-forge argon2-cffi-bindings 21.2.0 py38h96a0964_1 conda-forge asttokens 2.0.5 pyhd8ed1ab_0 conda-forge astunparse 1.6.3 pyhd8ed1ab_0 conda-forge async-timeout 4.0.2 pyhd8ed1ab_0 conda-forge attrs 21.4.0 pyhd8ed1ab_0 conda-forge babel 2.9.1 pyh44b312d_0 conda-forge backcall 0.2.0 pyh9f0ad1d_0 conda-forge backports 1.0 py_2 conda-forge backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge black 19.10b0 py38_0 conda-forge blas 2.112 mkl conda-forge blas-devel 3.9.0 12_osx64_mkl conda-forge bleach 4.1.0 pyhd8ed1ab_0 conda-forge blinker 1.4 py_1 conda-forge brotli 1.0.9 h0d85af4_6 conda-forge brotli-bin 1.0.9 h0d85af4_6 conda-forge brotlipy 0.7.0 py38h96a0964_1003 conda-forge bzip2 1.0.8 h0d85af4_4 conda-forge c-ares 1.18.1 h0d85af4_0 conda-forge ca-certificates 2021.10.8 h033912b_0 conda-forge cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge cachetools 4.2.4 pyhd8ed1ab_0 conda-forge cairo 1.16.0 he43a7df_1008 conda-forge certifi 2021.10.8 py38h50d1736_1 conda-forge cffi 1.15.0 py38h1a44b6c_0 conda-forge charset-normalizer 2.0.10 pyhd8ed1ab_0 conda-forge click 8.0.3 py38h50d1736_1 conda-forge colorama 0.4.4 pyh9f0ad1d_0 conda-forge cryptography 36.0.1 py38h56c4533_0 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge dataclasses 0.8 pyhc8e2a94_3 conda-forge debugpy 1.5.1 py38ha048514_0 conda-forge decorator 5.1.1 pyhd8ed1ab_0 conda-forge defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge entrypoints 0.3 pyhd8ed1ab_1003 conda-forge executing 0.8.2 pyhd8ed1ab_0 conda-forge ffmpeg 4.3 h0a44026_0 pytorch flit-core 3.6.0 pyhd8ed1ab_0 conda-forge fontconfig 2.13.1 h10f422b_1005 conda-forge fonttools 4.28.5 py38h96a0964_0 conda-forge freetype 2.10.4 h4cff582_1 conda-forge frozenlist 1.2.0 py38h96a0964_1 conda-forge gast 0.4.0 pyh9f0ad1d_0 conda-forge gettext 0.19.8.1 hd1a6beb_1008 conda-forge giflib 5.2.1 hbcb3906_2 conda-forge gmp 6.2.1 h2e338ed_0 conda-forge gnutls 3.6.13 h756fd2b_1 conda-forge google-auth 2.3.3 pyh6c4a22f_0 conda-forge google-auth-oauthlib 0.4.6 pyhd8ed1ab_0 conda-forge google-pasta 0.2.0 pyh8c360ce_0 conda-forge graphite2 1.3.13 h2e338ed_1001 conda-forge grpc-cpp 1.39.1 h3acd2d4_1 conda-forge grpcio 1.39.0 py38h4924b5d_0 conda-forge h5py 3.1.0 nompi_py38h5142359_100 conda-forge harfbuzz 2.9.1 h159f659_1 conda-forge hdf5 1.10.6 nompi_hc5d9132_1114 conda-forge icu 68.2 he49afe7_0 conda-forge idna 3.1 pyhd3deb0d_0 conda-forge importlib-metadata 4.10.0 py38h50d1736_0 conda-forge importlib_resources 5.4.0 pyhd8ed1ab_0 conda-forge ipykernel 6.7.0 py38h5fd9f69_0 conda-forge ipython 8.0.0 py38h50d1736_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jasper 1.900.1 h636a363_1006 conda-forge jbig 2.1 h0d85af4_2003 conda-forge jedi 0.18.1 py38h50d1736_0 conda-forge jinja2 3.0.3 pyhd8ed1ab_0 conda-forge jpeg 9d hbcb3906_0 conda-forge json5 0.9.5 pyh9f0ad1d_0 conda-forge jsonschema 4.4.0 pyhd8ed1ab_0 conda-forge jupyter_client 7.1.1 pyhd8ed1ab_0 conda-forge jupyter_core 4.9.1 py38h50d1736_1 conda-forge jupyter_server 1.13.3 pyhd8ed1ab_0 conda-forge jupyterlab 3.2.8 pyhd8ed1ab_0 conda-forge jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge jupyterlab_server 2.10.3 pyhd8ed1ab_0 conda-forge keras 2.6.0 pyhd8ed1ab_1 conda-forge keras-preprocessing 1.1.2 pyhd8ed1ab_0 conda-forge kiwisolver 1.3.2 py38h12bbefe_1 conda-forge krb5 1.19.2 hcfbf3a7_3 conda-forge lame 3.100 h35c211d_1001 conda-forge lcms2 2.12 h577c468_0 conda-forge lerc 3.0 he49afe7_0 conda-forge libblas 3.9.0 12_osx64_mkl conda-forge libbrotlicommon 1.0.9 h0d85af4_6 conda-forge libbrotlidec 1.0.9 h0d85af4_6 conda-forge libbrotlienc 1.0.9 h0d85af4_6 conda-forge libcblas 3.9.0 12_osx64_mkl conda-forge libcurl 7.81.0 hf45b732_0 conda-forge libcxx 12.0.1 habf9029_1 conda-forge libdeflate 1.8 h0d85af4_0 conda-forge libedit 3.1.20191231 h0678c8f_2 conda-forge libev 4.33 haf1e3a3_1 conda-forge libffi 3.4.2 h0d85af4_5 conda-forge libgfortran 5.0.0 9_3_0_h6c81a4c_23 conda-forge libgfortran5 9.3.0 h6c81a4c_23 conda-forge libglib 2.70.2 hf1fb8c0_1 conda-forge libiconv 1.16 haf1e3a3_0 conda-forge liblapack 3.9.0 12_osx64_mkl conda-forge liblapacke 3.9.0 12_osx64_mkl conda-forge libnghttp2 1.43.0 h6f36284_1 conda-forge libopencv 4.4.0 py38_2 conda-forge libpng 1.6.37 h7cec526_2 conda-forge libprotobuf 3.16.0 hcf210ce_0 conda-forge libsodium 1.0.18 hbcb3906_1 conda-forge libssh2 1.10.0 h52ee1ee_2 conda-forge libtiff 4.3.0 hd146c10_2 conda-forge libuv 1.43.0 h0d85af4_0 conda-forge libwebp-base 1.2.1 h0d85af4_0 conda-forge libxml2 2.9.12 h93ec3fd_0 conda-forge libzlib 1.2.11 h9173be1_1013 conda-forge llvm-openmp 12.0.1 hda6cdc1_1 conda-forge lz4-c 1.9.3 he49afe7_1 conda-forge markdown 3.3.6 pyhd8ed1ab_0 conda-forge markupsafe 2.0.1 py38h96a0964_1 conda-forge matplotlib 3.5.1 py38h50d1736_0 conda-forge matplotlib-base 3.5.1 py38hc7d2367_0 conda-forge matplotlib-inline 0.1.3 pyhd8ed1ab_0 conda-forge mistune 0.8.4 py38h96a0964_1005 conda-forge mkl 2021.4.0 h89fa619_689 conda-forge mkl-devel 2021.4.0 h694c41f_690 conda-forge mkl-include 2021.4.0 hf224eb6_689 conda-forge multidict 5.2.0 py38h96a0964_1 conda-forge munkres 1.1.4 pyh9f0ad1d_0 conda-forge mypy_extensions 0.4.3 py38h50d1736_4 conda-forge nbclassic 0.3.5 pyhd8ed1ab_0 conda-forge nbclient 0.5.10 pyhd8ed1ab_1 conda-forge nbconvert 6.4.0 py38h50d1736_0 conda-forge nbformat 5.1.3 pyhd8ed1ab_0 conda-forge ncurses 6.2 h2e338ed_4 conda-forge nest-asyncio 1.5.4 pyhd8ed1ab_0 conda-forge nettle 3.6 hedd7734_0 conda-forge notebook 6.4.7 pyha770c72_0 conda-forge numpy 1.19.5 py38had91d27_2 conda-forge oauthlib 3.1.1 pyhd8ed1ab_0 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge opencv 4.4.0 py38_2 conda-forge openh264 2.1.1 hfd3ada9_0 conda-forge openjpeg 2.4.0 h6e7aa92_1 conda-forge openssl 1.1.1l h0d85af4_0 conda-forge opt_einsum 3.3.0 pyhd8ed1ab_1 conda-forge packaging 21.3 pyhd8ed1ab_0 conda-forge pandas 1.3.5 py38ha53d530_0 conda-forge pandoc 2.17 h0d85af4_0 conda-forge pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge parso 0.8.3 pyhd8ed1ab_0 conda-forge pathspec 0.9.0 pyhd8ed1ab_0 conda-forge patsy 0.5.2 pyhd8ed1ab_0 conda-forge pcre 8.45 he49afe7_0 conda-forge pexpect 4.8.0 pyh9f0ad1d_2 conda-forge pickleshare 0.7.5 py_1003 conda-forge pillow 8.4.0 py38hee640a0_0 conda-forge pip 21.3.1 pyhd8ed1ab_0 conda-forge pixman 0.40.0 hbcb3906_0 conda-forge prometheus_client 0.12.0 pyhd8ed1ab_0 conda-forge prompt-toolkit 3.0.24 pyha770c72_0 conda-forge protobuf 3.16.0 py38ha048514_0 conda-forge ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge pure_eval 0.2.1 pyhd8ed1ab_1 conda-forge py-opencv 4.4.0 py38h23f93f0_2 conda-forge pyasn1 0.4.8 py_0 conda-forge pyasn1-modules 0.2.7 py_0 conda-forge pycparser 2.21 pyhd8ed1ab_0 conda-forge pygments 2.11.2 pyhd8ed1ab_0 conda-forge pyjwt 2.3.0 pyhd8ed1ab_1 conda-forge pyopenssl 21.0.0 pyhd8ed1ab_0 conda-forge pyparsing 3.0.6 pyhd8ed1ab_0 conda-forge pyrsistent 0.18.0 py38h96a0964_0 conda-forge pysocks 1.7.1 py38h50d1736_4 conda-forge python 3.8.12 h17280f6_2_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-flatbuffers 1.12 pyhd8ed1ab_1 conda-forge python_abi 3.8 2_cp38 conda-forge pytorch 1.10.1 py3.8_0 pytorch pytz 2021.3 pyhd8ed1ab_0 conda-forge pyu2f 0.1.5 pyhd8ed1ab_0 conda-forge pyyaml 6.0 py38h96a0964_3 conda-forge pyzmq 22.3.0 py38hd3b92b6_1 conda-forge re2 2021.09.01 he49afe7_0 conda-forge readline 8.1 h05e3726_0 conda-forge regex 2021.11.10 py38h96a0964_0 conda-forge requests 2.27.1 pyhd8ed1ab_0 conda-forge requests-oauthlib 1.3.0 pyh9f0ad1d_0 conda-forge rsa 4.8 pyhd8ed1ab_0 conda-forge scipy 1.7.3 py38hd329d04_0 conda-forge seaborn 0.11.2 hd8ed1ab_0 conda-forge seaborn-base 0.11.2 pyhd8ed1ab_0 conda-forge send2trash 1.8.0 pyhd8ed1ab_0 conda-forge setuptools 60.5.0 py38h50d1736_0 conda-forge six 1.15.0 pyh9f0ad1d_0 conda-forge snappy 1.1.8 hb1e8313_3 conda-forge sniffio 1.2.0 py38h50d1736_2 conda-forge sqlite 3.37.0 h23a322b_0 conda-forge stack_data 0.1.3 pyhd8ed1ab_1 conda-forge statsmodels 0.13.1 py38hbe852b5_0 conda-forge tbb 2021.5.0 h940c156_0 conda-forge tensorboard 2.7.0 pyhd8ed1ab_0 conda-forge tensorboard-data-server 0.6.0 py38h56c4533_1 conda-forge tensorboard-plugin-wit 1.8.1 pyhd8ed1ab_0 conda-forge tensorflow 2.6.0 py38h52b2510_1 conda-forge tensorflow-base 2.6.0 py38h1615122_1 conda-forge tensorflow-estimator 2.6.0 py38h02c4698_1 conda-forge termcolor 1.1.0 py_2 conda-forge terminado 0.12.1 py38h50d1736_1 conda-forge testpath 0.5.0 pyhd8ed1ab_0 conda-forge tk 8.6.11 h5dbffcc_1 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge torchvision 0.11.2 py38_cpu pytorch tornado 6.1 py38h96a0964_2 conda-forge tqdm 4.62.3 pyhd8ed1ab_0 conda-forge traitlets 5.1.1 pyhd8ed1ab_0 conda-forge typed-ast 1.5.1 py38h96a0964_0 conda-forge typing-extensions 3.7.4.3 0 conda-forge typing_extensions 3.7.4.3 py_0 conda-forge unicodedata2 14.0.0 py38h96a0964_0 conda-forge urllib3 1.26.8 pyhd8ed1ab_1 conda-forge wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge webencodings 0.5.1 py_1 conda-forge websocket-client 1.2.3 pyhd8ed1ab_0 conda-forge werkzeug 2.0.1 pyhd8ed1ab_0 conda-forge wheel 0.37.1 pyhd8ed1ab_0 conda-forge wrapt 1.12.1 py38h96a0964_3 conda-forge xz 5.2.5 haf1e3a3_1 conda-forge yaml 0.2.5 h0d85af4_2 conda-forge yarl 1.7.2 py38h96a0964_1 conda-forge zeromq 4.3.4 he49afe7_1 conda-forge zipp 3.7.0 pyhd8ed1ab_0 conda-forge zlib 1.2.11 h9173be1_1013 conda-forge zstd 1.5.1 h582d3a0_0 conda-forge ```


Details about conda and system ( conda info ):

``` $ conda info active environment : ml active env location : /Users/Abc/.local/lib/conda/ml shell level : 1 user config file : /Users/Abc/.condarc populated config files : /Users/Abc/.condarc conda version : 4.11.0 conda-build version : not installed python version : 3.9.5.final.0 virtual packages : __osx=10.16=0 __unix=0=0 __archspec=1=x86_64 base environment : /Users/Abc/.local/libexec/conda (writable) conda av data dir : /Users/Abc/.local/libexec/conda/etc/conda conda av metadata url : None channel URLs : https://conda.anaconda.org/pytorch/osx-64 https://conda.anaconda.org/pytorch/noarch https://conda.anaconda.org/conda-forge/osx-64 https://conda.anaconda.org/conda-forge/noarch https://repo.anaconda.com/pkgs/main/osx-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/osx-64 https://repo.anaconda.com/pkgs/r/noarch package cache : /Users/Abc/.local/libexec/conda/pkgs /Users/Abc/.conda/pkgs envs directories : /Users/Abc/.local/lib/conda /Users/Abc/.local/libexec/conda/envs /Users/Abc/.conda/envs platform : osx-64 user-agent : conda/4.11.0 requests/2.26.0 CPython/3.9.5 Darwin/21.2.0 OSX/10.16 UID:GID : 501:20 netrc file : None offline mode : False ```
hmaarrfk commented 2 years ago

Thank you for including all the information.

You've installed pytorch from the pytorch channel which seems to install a specific version of ffmpeg.

This is causing your issues.

Since it appears you are using OSX, you may try to install pytorch from conda-forge. we built it too. As far as i know, it is all consistent.

Best of luck with integrating your software.