title: This application failed to start because it could not find or load the Qt platform plugin "xcb" in ""
body: <p>I have an application which runs using Qt5 (via PyQt). I am using miniconda and the python code has been cythonised. The code was setup on my local machine, the cython code produced from the original <code>.py</code> files and the relevant libraries and modules installed in miniconda such that the code runs successfully. Then I ship everything to another machine, compile the cython code to give <code>.so</code> files and attempt to run it. At this point I get the error:</p>
  
  <pre><code>This application failed to start because it could not find or load the Qt platform plugin "xcb"
  in "".
  
  Reinstalling the application may fix this problem.
  Aborted (core dumped)
  </code></pre>
  
  <p>I have looked around for a long time for possible solutions and I have the following extra information:</p>
  
  <p>I have checked ldd on the various <code>.so</code> files. All seem to find the required libraries.</p>
  
  <p>I have tried <code>locate libqxcb.so</code> and this returns:
  <code>~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so</code>
  &amp;
  <code>~/miniconda3/plugins/platforms/libqxcb.so</code></p>
  
  <p>Based on the suggestions <a href="https://stackoverflow.com/questions/17106315/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without">here</a> from TranslucentCloud, I have copied this to the directory <code>~/miniconda3/bin/platforms</code> (newly created).</p>
  
  <p>I have also included <code>export QT_DEBUG_PLUGINS=1</code> in the script which calls my code. This gives the following output:</p>
  
  <pre><code>QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforms" ...
  QFactoryLoader::QFactoryLoader() looking at "~/miniconda3/bin/platforms/libqxcb.so"
  Found metadata in lib ~/miniconda3/bin/platforms/libqxcb.so, metadata=
  {
      "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
      "MetaData": {
          "Keys": [
              "xcb"
          ]
      },
      "className": "QXcbIntegrationPlugin",
      "debug": false,
      "version": 329218
  }
  
  
  Got keys from plugin meta data ("xcb")
  loaded library "~/miniconda3/bin/platforms/libqxcb.so"
  xkbcommon: ERROR: failed to add default include path ~/Programmes/miniconda3/lib
  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/ .
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/xcbglintegrations" ...
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platformthemes" ...
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforminputcontexts" ...
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/styles" ...
  Fontconfig error: Cannot load default config file
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessible" ...
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessiblebridge" ...
  QXcbConnection: XCB error: 145 (Unknown), sequence: 165, resource id: 0, major code: 139 (Unknown), minor code: 20
  QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/imageformats" ...
  QLibraryPrivate::unload succeeded on "~/miniconda3/bin/platforms/libqxcb.so"
  </code></pre>
  
  <p>The GUI now loads and buttons etc work. However, there are still a few issues - the minor issue is that all the fonts are different from my local machine (not a major problem, but presumably indicative that it's still not finding some relevant libraries).</p>
  
  <p>More seriously, the GUI doesn't respond to any key presses - the GUI has lots of text boxes to fill in so this makes it unusable.</p>
  
  <p>There are clearly some errors still in the output above, however, it's not clear from this which libraries etc. it is still unable to find (or why this is the case). </p>