Error with OpenCV imshow in anaconda environment

981 Views Asked by At

I've been trying to use imshow in conda, but I get this error:

Traceback (most recent call last): File "Online_fordprop.py", line 33, in cv2.imshow("test", frame) cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'

I've seen this error in other threads and I've tried everything in the comments, but it doesn't work. I have opencv-contrib-python 4.4.0.44 in the conda environment, but I suspect that there's another OpenCV version in the computer because when I run

import cv2
cv2.__version__

in an environment with no OpenCV libraries, it returns 3.4.2.

Any idea how I can get rid of that opencv background or how to make the imshow command work?

Update: I have run sudo apt-get purge 'opencv' and so I can no longer use import cv2 when the environment has no OpenCV libraries, but I still get the same error explained above.

1

There are 1 best solutions below

0
On

Creating a new environment and installing opencv-python by pip worked.