1

I am running 4.1.0 with python 3.7.3. I installed opencv using conda:

conda install -c conda-forge opencv

I don't have any experience using Qt. I am simply trying to show an image or a video using the OpenCV imshow method:

cv.imshow('Result (Press any key to exit)', img)
cv.waitKey(0)
cv.destroyAllWindows()

But when I run the program, I get this error:

xkbcommon: ERROR: failed to add default include path 
Qt: Failed to create XKB context!
Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ':' as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .

The program continues to run just fine. However cv.waitKey(0) is not working. I read up about setting the environment variable, but I plan to bundle this program using pyinstaller, so I can't rely on this fix forever.

Is there a permanent fix?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Josh Sharkey
  • 1,008
  • 9
  • 34

1 Answers1

1

Issue is referenced here: https://github.com/conda-forge/qt-feedstock/issues/104. Fixes have been merged into master.

For Ubuntu, you can update Qt to fix this issue:

conda install -c conda-forge qt

qt 5.9.7-h52cfd70_1 --> 5.9.7-h52cfd70_2

Josh Sharkey
  • 1,008
  • 9
  • 34