imshow: The function is not implemented

  • Python
  • OpenCV

You may see

error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support.

Why it happens

  • opencv-python-headless is installed, perhaps beside the normal one.
  • You're in Colab, which has no windows.

How to fix it

  1. pip uninstall opencv-python opencv-python-headless, then pip install opencv-python.
  2. In Colab use from google.colab.patches import cv2_imshow.

It worked if: The window opens.

From the official documentation. Wording from the OpenCV source; the two packages from the opencv-python page. Sources: opencv-python: README and questions.

Didn't help? Search another error or ask us.