Reputation: 251
I am trying to run Tesseract Ocr code as mentioned here https://www.pyimagesearch.com/2018/09/17/opencv-ocr-and-text-recognition-with-tesseract/ on ec2 ubuntu server 20.0.
I am facing an error on:
cv2.imshow("Text Detection", output)
The error is as follows:
qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc.
Aborted (core dumped)
I know this line of code would open a window to display the image of detected output ,but that window is not showing up.Please help with the error.
Upvotes: 4
Views: 5016
Reputation: 1
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
libgl1-mesa-glx : Depends: libgl1 but it is not going to be installed
Depends: libglx-mesa0 but it is not going to be installed
libgtk2.0-dev : Depends: libgtk2.0-0 (= 2.24.32-4ubuntu4) but it is not going to be installed
Depends: gir1.2-gtk-2.0 (= 2.24.32-4ubuntu4) but it is not going to be installed
Depends: libgtk2.0-common but it is not going to be installed
Depends: libglib2.0-dev (>= 2.27.3) but it is not going to be installed
Depends: libgdk-pixbuf2.0-dev (>= 2.21.0) but it is not going to be installed
Depends: libpango1.0-dev (>= 1.20) but it is not going to be installed
Depends: libatk1.0-dev (>= 1.29.2) but it is not going to be installed
Depends: libcairo2-dev (>= 1.6.4-6.1) but it is not going to be installed
Depends: libx11-dev (>= 2:1.0.0-6) but it is not going to be installed
Depends: libxext-dev (>= 1:1.0.1-2) but it is not going to be installed
Depends: libxinerama-dev (>= 1:1.0.1-4.1) but it is not going to be installed
Depends: libxi-dev (>= 1:1.0.1-4) but it is not going to be installed
Depends: libxrandr-dev (>= 2:1.2.99) but it is not going to be installed
Depends: libxcursor-dev but it is not going to be installed
Depends: libxfixes-dev (>= 1:3.0.0-3) but it is not going to be installed
Depends: libxcomposite-dev (>= 1:0.2.0-3) but it is not going to be installed
Depends: libxdamage-dev (>= 1:1.0.1-3) but it is not going to be installed
Depends: libxml2-utils but it is not going to be installed
Recommends: debhelper but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
In my past experience, pycharm can do local visualization, but sometimes it will go wrong, is this related to the pycharm version or is it related to the remote server.
Upvotes: 0
Reputation: 1179
You got this error because there was no UI to open up a window and show the image.
A quick fix will be to save and download the image. And view locally.
Another way is to setup a XServer and enable X11 forwarding via SSH.
Upvotes: 0