6

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?

4
  • 1
    Did you find a solution? I'm facing the same issue. :( Commented Dec 16, 2016 at 9:29
  • @SwaathiKakarla Did you find a sol? Commented Dec 22, 2016 at 13:48
  • Sorry unable to find any solution yet, probably install from source is an option. Commented Dec 24, 2016 at 0:50
  • Did you try placing cv2.waitKey() function after cv2.imshow() ? Commented Jan 6, 2017 at 14:17

2 Answers 2

3

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
Sign up to request clarification or add additional context in comments.

1 Comment

After installing with brew it says what commands should be perform for python bindings. In my case these 3 did the job: 1) echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth 2)mkdir -p /Users/___XXX___yourHomeDir___XXX___/Library/Python/2.7/lib/python/site-packages 3)echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/___XXX___yourHomeDir___XXX___/Library/Python/2.7/lib/python/site-packages/homebrew.pth
0

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!

1 Comment

The post is 7 months old, the poster probably moved to something else. Recommending him to rewrite a project is not either an accurate answer for other users facing similar issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.