简体   繁体   中英

Receive an error from lingnutls/'Hogweed' when importing CV2

I've never seen an error like this and don't know where to start. I installed opencv with

conda install opencv

and am running Ubuntu Linux 18.04 using a conda environment named fpn. How should I even approach debugging this?

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    import cv2
ImportError: /home/s/miniconda3/envs/fpn/lib/python3.7/site-packages/../../././libgnutls.so.30: symbol mpn_add_1 version HOGWEED_4 not defined in file libhogweed.so.4 with link time reference

There seems to be a problem with the recent releases of opencv packages for Conda. I have tested all the 4.x releases and found that the problem occurs starting from 4.3. Unless you really depend on >=4.3, forcing a version prior to 4.3 solves the problem,

name: test
channels:
 - anaconda
 - conda-forge
dependencies:
 - python>=3.8
 - opencv<4.3

in my cases this installed 4.2.0. Importing cv2 in Python works fine then. Note that using conda update didn't work for me and I still got the error, but I had to first remove the environment and then re-create it . I think this behavior indicates that the error is rooted in some dependency of opencv , which is not properly down-graded when conda update is used.

I don't consider this a true solution, but installing via pip with

pip install opencv-python

does work with no problem. Shouldn't there be a way to install with conda?

The problem seems to happen with a mix between conda-forge and anaconda packages, which aren't compatible. I encountered the same problem; the ultimate issue was having conda-forge configured with lower priority than anaconda. This caused the anaconda packages, which were incompatible, to be installed when there was an option. This is, of course, a bad idea - since conda-forge assumes anaconda availability, but not vice versa

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