0
votes

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
Usually it's installed from apt. In that case, you should be able to see it returned by this command apt search python3-opencv | grep installedYohanes Gultom
It returns: 'WARNING: apt does not have a stable CLI interface. Use with caution in scripts.'Aquas
Do you know how to create a conda environment? If you know it, then create a new anaconda environment, then install opencv and contrib the problem will be solved. If you don't know I will write as an answer.Ahx
Creating a new environment and installing opencv-python by pip worked. ThanksAquas
Can you share the list of packages in the environment?AMC

1 Answers

1
votes

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