How to fix the pyinstaller xcb plugin issue when using opencv on linux

Viewed 251

I'm writting a python (3.9) application and want to distribute the executable using pyinstaller. I'm running pyinstaller -w -F ... inside a pipenv environment with opencv-contrib-python==4.5.4.60, opencv-python==4.5.4.60 and numpy==1.21.4.

The resulting executable keeps giving me this error:

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/tmp/_MEIuynHyq/cv2/qt/plugins"
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

Many posts suggest to change downgrade the libraries. I tried this and many other things with no success. Tips, advice would be greatly appreciated.

Cheers

1 Answers
  1. This problem can be solved with:

This might be solvable by changing the order of imports, object instantiation, or both. Changing the plugin loading path might be possible, although python modules sometimes hardcode their own idea of where things should come from. Deleting the cv2 version of the plugin might work. If those options are unworkable or unreasonable, you may be stuck rebuilding PyQt and/or OpenCV.

  1. But I am not strong in plugins cv2 and qt for this, in my case, the problem was solved by downgrading cv2
Related