3

I was trying an OpenCV tutorial and when I run the python code I got this error

OpenCV Error: 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 cvShowImage, file /home/pankaja/Desktop/OpenCV-tmp/opencv/modules/highgui/src/window.cpp, line 611
Traceback (most recent call last):
  File "/home/pankaja/PycharmProjects/ImageProcessing/imageprocess.py", line 8, in <module>
    cv2.imshow('image', img)
cv2.error: /home/pankaja/Desktop/OpenCV-tmp/opencv/modules/highgui/src/window.cpp:611: error: (-2) 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

So as for OpenCV error: the function is not implemented this stackoverflow answer I tried the command sudo apt-get install libopencv-* and got this,

*The following packages have unmet dependencies:
 libopencv-apps-dev : Depends: libcv-bridge-dev but it is not going to be installed
                      Depends: libdynamic-reconfigure-config-init-mutex-dev but it is not going to be installed
                      Depends: libimage-transport-dev but it is not going to be installed
                      Depends: libnodeletlib-dev but it is not going to be installed
                      Depends: libroscpp-dev but it is not going to be installed
 libopencv-highgui-dev : Depends: libgtk2.0-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.*

How to solve this? What have I done wrong ?

Edit 1 : after I run sudo apt-get install -f as @Jeru Luke mentioned

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libenca0 librubberband2v5 libva-wayland1 linux-headers-4.10.0-27 linux-headers-4.10.0-27-generic linux-headers-4.10.0-30
  linux-headers-4.10.0-30-generic linux-headers-4.4.0-89 linux-headers-4.4.0-89-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-image-4.10.0-27-generic linux-image-4.10.0-30-generic linux-image-4.4.0-89-generic linux-image-4.4.0-92-generic
  linux-image-extra-4.10.0-27-generic linux-image-extra-4.10.0-30-generic linux-image-extra-4.4.0-89-generic
  linux-image-extra-4.4.0-92-generic linux-signed-image-4.10.0-27-generic linux-signed-image-4.10.0-30-generic mpv rtmpdump
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

still getting the error when I run sudo apt-get install libopencv-*

Edit 2 : After run the sudo apt-get install libgtk-3-dev command as @Zindarod mentioned

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgtk-3-dev : Depends: libgtk-3-0 (= 3.18.9-1ubuntu3) but 3.18.9-1ubuntu3.3 is to be installed
                Depends: gir1.2-gtk-3.0 (= 3.18.9-1ubuntu3) but 3.18.9-1ubuntu3.3 is to be installed
                Depends: libatk-bridge2.0-dev but it is not going to be installed
                Depends: libepoxy-dev (>= 1.0) but it is not going to be installed
                Depends: libegl1-mesa-dev but it is not going to be installed
                Depends: libwayland-dev (>= 1.5.91) but it is not going to be installed
                Depends: libmirclient-dev (>= 0.13.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

still no luck

Thidasa Pankaja
  • 930
  • 8
  • 25
  • 44
  • Use `sudo apt-get install -f` to fix broken or missing dependencies. – Jeru Luke Sep 04 '17 at 16:51
  • Thanks for the help, I tried that already, but this is what I got Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: . . . 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. And still when I run this command **sudo apt-get install libopencv-*** I'm getting the same error – Thidasa Pankaja Sep 04 '17 at 16:56
  • `sudo apt-get install libgtk-3-dev` – zindarod Sep 04 '17 at 16:56
  • @Zindarod Depends: libgtk-3-0 (= 3.18.9-1ubuntu3) but 3.18.9-1ubuntu3.3 is to be installed Depends: gir1.2-gtk-3.0 (= 3.18.9-1ubuntu3) but 3.18.9-1ubuntu3.3 is to be installed Depends: libatk-bridge2.0-dev but it is not going to be installed Depends: libepoxy-dev (>= 1.0) but it is not going to be installed Depends: libegl1-mesa-dev but it is not going to be installed Depends: libwayland-dev (>= 1.5.91) but it is not going to be installed.. E: Unable to correct problems, you have held broken packages. – Thidasa Pankaja Sep 04 '17 at 17:02
  • @ThidasaParanavitharana adding these comments in the question as an edit would be helpful – Jeru Luke Sep 04 '17 at 17:03
  • @JeruLuke I edited the question, Thanks – Thidasa Pankaja Sep 04 '17 at 17:10
  • I struggled with this same error during this past week. Unfortunatelly, I am not sure what solved it... But, I ended up compiling OpenCV itself and these are all the prerequisites I am installing. "RUN apt-get install -y build-essential cmake pkg-config libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev gfortran python2.7-dev python3.5-dev wget zip" – Pedro Sep 05 '17 at 00:44
  • It was a bit trial and error. And I think the article from [here](http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/) is, more or less, what I ended up following. – Pedro Sep 05 '17 at 00:47
  • @Pedro I solved that unment dependency problem by installing the pckages using **sudo aptitude install** so, that's no longer a problem. But still I'm getting the error when I run python code. I have installed libgtk2.0-dev already. But still having the error – Thidasa Pankaja Sep 05 '17 at 03:12

0 Answers0