6
votes

I installed opencv-python using pip install, in mac os. Now the cv2.imshow function giving following 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

How can I solve this issue? Why doesn't the pip check opencv dependencies?

2
Did you find a solution? I'm facing the same issue. :(Swaathi Kakarla
@SwaathiKakarla Did you find a sol?Akashdeep Saluja
Sorry unable to find any solution yet, probably install from source is an option.Ras
Did you try placing cv2.waitKey() function after cv2.imshow() ?Jeru Luke

2 Answers

3
votes

Seems launching imshow windows doesn't work when installing opencv-python from pypi. Instead remove that and follow the great instructions at http://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/

(Note that no longer need to use --HEAD tag, as of 3.2.0)

In short:

  • Ensure Xcode installed
  • brew tap homebrew/science
  • brew install opencv3 --with-contrib
  • echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> (YOUR PYTHONPATH)/lib/python2.7/site-packages/opencv3.pth
0
votes

The fix that worked best for me was using mathplotlib instead.

Since you may have to remove all previous versions of OpenCV otherwise and reinstall from source!