Opencv-python: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window.cpp:634: error: (-2:Unspecified error) The function is not implemented

Created on 29 Apr 2020  路  1Comment  路  Source: opencv/opencv-python

System information (version)

OpenCV => 4.2.0
Operating System / Platform => Windows 10
Compiler => Juypter Hub

I am getting an error while running this code:

img = cv2.imread("Screenshot.png")
cv2.imshow(" ", img)

Error: OpenCV(4.2.0) /io/opencv/modules/highgui/src/window.cpp:634: 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 'cvNamedWindow'

Installation process was:
pip install opencv-python-headless

By going through this issue it seems that I cannot use cv2.imshow()on a remotely hosted jupyter. Is there any workaround except for switching compiler?

Most helpful comment

The issue is not related to this repository. It's related to your environment and how you use opencv-python. There are questions regarding this at Stack Overflow, see for example https://stackoverflow.com/questions/55231943/how-to-use-opencv-in-a-remote-jupyter-notebook-execution

opencv-python-headless does not include GUI support (as explained by berak in the linked issue). Please read the README file and do as it suggests: uninstall opencv-python-headless and install opencv-python and you will get support for cv2.imshow etc.

BUT as your code runs on a remote machine, you'll need X11 forwarding to see the remote system GUI windows on your local machine. Please seek help for example at Stack Overflow. This repository is just an automated build toolchain which creates pre-built OpenCV packages for Python.

>All comments

The issue is not related to this repository. It's related to your environment and how you use opencv-python. There are questions regarding this at Stack Overflow, see for example https://stackoverflow.com/questions/55231943/how-to-use-opencv-in-a-remote-jupyter-notebook-execution

opencv-python-headless does not include GUI support (as explained by berak in the linked issue). Please read the README file and do as it suggests: uninstall opencv-python-headless and install opencv-python and you will get support for cv2.imshow etc.

BUT as your code runs on a remote machine, you'll need X11 forwarding to see the remote system GUI windows on your local machine. Please seek help for example at Stack Overflow. This repository is just an automated build toolchain which creates pre-built OpenCV packages for Python.

Was this page helpful?
0 / 5 - 0 ratings