Could not find or load the Qt platform plugin "xcb" Could not find or load the Qt platform plugin "xcb" linux linux

Could not find or load the Qt platform plugin "xcb"


Same problem with Linux Mint 17, 64 bit. It was solved after 4h searching on the net! You need to give these commands on the terminal from folder /anaconda2/bin

sudo ./conda remove qtsudo ./conda remove pyqtsudo ./conda install qtsudo ./conda install pyqt

Hope it helps!


To fix this problem, I added to the top:

import matplotlibmatplotlib.use('Agg')

I have a CentOS7, Anaconda3-4.5.0, python3.5pyqt version 5.6.0 and qt version 5.6.0

If you want to use the plot in a Tkinter window for visualisation then use:

matplotlib.use('TkAgg')


I experienced this problem on Ubuntu 16.04 with anaconda 4.3.17 (Python 2.7). The issue stemmed from anaconda having Qt version 5.6 installed, while my system Qt libraries were at version 5.5.

A quick hack is to make sure Anaconda libraries precede your system libraries by setting LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$HOME/anaconda2/lib:$LD_LIBRARY_PATH

Unfortunately, this will break other programs that use Qt 5.5, so you can only use it in situations that are 100% anaconda python, for example, if you're starting an ipython session with --pylab.

I discovered that this was the issue by looking at the way libxqcb.so was linked:

ldd $HOME/anaconda2/plugins/platforms/libqxcb.so

which reported the following errors:

./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: version `Qt_5_PRIVATE_API' not found (required by ./libqxcb.so)./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by ./libqxcb.so)./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5' not found (required by ./libqxcb.so)./libqxcb.so: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.6' not found (required by ./libqxcb.so)

The error messages are saying they can't find Qt_5.6, which is anaconda's version. The version on my system was 5.5, which I found out by looking at the filenames that resulted from this command:

ls /usr/lib/x86_64-linux-gnu/libQt*