akai-katto / dandere2x

Dandere2x - Fast Waifu2x Video Upscaling.
https://www.reddit.com/r/Dandere2x/
GNU General Public License v3.0
1.45k stars 77 forks source link

Linux (Ubuntu) - qt.qpa.plugin: Could not load the Qt platform plugin "xcb" #208

Closed peepo5 closed 3 years ago

peepo5 commented 3 years ago

Using this version

After running the bash script, and commands here (which by the way is missing a cd ./src), when I run:

(venv) > $ python3 ./main.py It returns:

QObject::moveToThread: Current thread (0x1a3df50) is not the object's thread (0x1906cf0).
Cannot move to target thread (0x1a3df50)

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/mnt/mydrive/upscale/dandere2x/venv/lib/python3.8/site-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.

The guy here had the same issue but there was no public response

What could be the cause of this problem?

Tremeschin commented 3 years ago

IIRC this is an issue with OpenCV and Qt having some shared common libs, try uninstalling opencv-contrib-python that I see in Dandere2x's requirements.txt in favor of opencv-contrib-python-headless because it doesn't have any GUI component.

On your venv:

From the opencv-contrib-python-headless itself here:

These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result.

Think xcb is the x11 implementation of Qt platform so it makes sense the issue I'd say.

I'll warn Tyler about this rn, had this issue as well on a repo of mine.

VerbTheNoun95 commented 3 years ago

This worked for me, thanks!

Tarliton commented 3 years ago

I was having the same problem. Besides installing the headless version of opencv-contrib-python I had to install this package too:

sudo apt-get install libxcb-xinerama0
exu-g commented 3 years ago

I had to install opencv-contrib-python first (in requirements.txt) and after that installed opencv-contrib-python-headless. Without both packages the program failed to launch for me.

KyuuAme commented 3 years ago

IIRC this is an issue with OpenCV and Qt having some shared common libs, try uninstalling opencv-contrib-python that I see in Dandere2x's requirements.txt in favor of opencv-contrib-python-headless because it doesn't have any GUI component.

On your venv:

  • python3 -m pip uninstall opencv-contrib-python
  • python3 -m pip install opencv-contrib-python-headless

From the opencv-contrib-python-headless itself here:

These packages are smaller than the two other packages above because they do not contain any GUI functionality (not compiled with Qt / other GUI components). This means that the packages avoid a heavy dependency chain to X11 libraries and you will have for example smaller Docker images as a result.

Think xcb is the x11 implementation of Qt platform so it makes sense the issue I'd say.

I'll warn Tyler about this rn, had this issue as well on a repo of mine.

This worked for me as well, thanks!