(-2:Unspecified error) Rebuild the library ... - any guidance?

I am new to OpenCV, and this is my first attempt, writing in Python on Ubuntu 22.04, and I had the error:-

OpenCV(4.8.1) /io/opencv/modules/highgui/src/window.cpp:1272: 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'

I have installed libgtk2.0-dev and pkg-config, (and I still get the error) but I don’t understand how to re-run cmake/ … as I installed openCV from pip.

My versions of openCV are:-

opencv-python              /home/<user>/anaconda3/lib/python3.7/site-packages pip
opencv-python-headless     /home/<user>/anaconda3/lib/python3.7/site-packages pip

Any guidance would be most appreciated.


just uninstall the headless version.
there should be exactly 1 opencv install only on your box anyway