Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

package

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
like image 623
roshambo Avatar asked Oct 15 '22 23:10

roshambo


2 Answers

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.

like image 192
theV0ID Avatar answered Nov 15 '22 05:11

theV0ID


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?

like image 45
roshambo Avatar answered Nov 15 '22 04:11

roshambo