History, I have been running OpenCV on Raspbian Stretch in a virtual environment for a couple of years. Due to the requirement to add functionality for a PS4 controller I switched to Raspbian Buster. I re-installed OpenCV 4.5.1 (opencv-contrib-python) using the PyImageSearch pip guide here

Now, I have been tryinig to run some of my known working OpenCV python programs, remote headless using vncserver and vncviewer (Mac) and with a monitor and kbd attached, but keep getting the following error:

cv2.error: OpenCV(4.5.1) /tmp/pip-install-hyt7ii05/opencv-contrib-python_3f506ec0b739451b84e2498020092625/opencv/modules/highgui/src/window.cpp:651: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa 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'

Any ideas on the correct way to solve this - I understand I need to install libgtk and pkg-config, but want to do it correctly.

  • start with apt install libgtk2.0-dev pkg-config - basically, if something suggests you "install" something, apt install something is pretty much the way to do it "correctly" (raspberry pi OS is Debian based) Commented May 24, 2021 at 9:21
  • Yes, but then it says "re-run 'cmake'"? Commented May 24, 2021 at 9:39
  • or configure script in function 'cvShowImage' - I take it neither of those things mean anything to you? Commented May 24, 2021 at 9:52
  • No sorry, don't know how to configure cvShowImage? Commented May 24, 2021 at 10:13
  • Any one else have any ideas on how to resolve this? It seems there is a problem with Buster and OpenCV? Commented May 25, 2021 at 17:50

1 Answer 1


After you install libgtk2.0-dev pkg-config, you need to uninstall then purge your previous version of opencv: pip uninstall opencv-contrib-python then pip cache purge. For me, that was the issue, python kept rebuilding the old version. You can then reinstall: pip install opencv-contrib-python

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.