conda python 3.7 opencv import error libgnutls.so.30: undefined symbol: mpn_add_1, version HOGWEED_4

Viewed 1824

I am facing problem while getting opencv to work with python 3.7 in Conda on Ubuntu 20.04.

I get the following error when I try to import cv2 in python:

$ python
Python 3.7.8 | packaged by conda-forge | (default, Jul 23 2020, 03:54:19) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/swagat/anaconda3/envs/tf2py37/lib/python3.7/site-packages/../../././libgnutls.so.30: undefined symbol: mpn_add_1, version HOGWEED_4

my Conda configuration looks something like this:


active environment : tf2py37
    active env location : /home/swagat/anaconda3/envs/tf2py37
            shell level : 2
       user config file : /home/swagat/.condarc
 populated config files : 
          conda version : 4.8.5
    conda-build version : 3.18.9
         python version : 3.7.4.final.0
       virtual packages : __cuda=10.1
                          __glibc=2.31

I installed opencv from the conda-forge channel using the following command: $ conda install -c conda-forge opencv

I can see that opencv is installed on my system:

$ conda list opencv
# packages in environment at /home/swagat/anaconda3/envs/tf2py37:
#
# Name                    Version                   Build  Channel
libopencv                 4.5.0                    py37_2    conda-forge
opencv                    4.5.0                    py37_2    conda-forge
py-opencv                 4.5.0            py37hc6149b9_2    conda-forge

I also checked if gnutls is installed:

$ conda list gnutls
# packages in environment at /home/swagat/anaconda3/envs/tf2py37:
#
# Name                    Version                   Build  Channel
gnutls                    3.6.13               h79a8f9a_0    conda-forge

What else I can try to solve this problem? I am kind of stuck here. Any help will be appreciated. Thanks.

1 Answers

It seems that conda version of the opencv is broken.

My solution is:

remove your conda opencv and install the native one:

conda remove opencv

python -m pip install opencv-python # Execute this with your conda env activated

Related