Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

On my OS(Linux Mint Debian Edition 2), except for the system python(/usr/bin/python) installed by the apt, I also installed the anaconda. But I've encounterd a problem running the following code with the anaconda python

# test.py import matplotlib.pyplot as plt import numpy as np x = np.array([0, 1]) plt.scatter(x, x) plt.show() 

The error is

This application failed to start because it could not find or load the Qt platform plugin "xcb".

Reinstalling the application may fix this problem.

Aborted

But if I try with the system python, i.e., /usr/bin/python test.py, it works correctly.

Then I tried the ipythons, of system and of anaconda, the result is same as before: the anaconda ipython kernel died.

And I tried add the ipython magic %matplotlib inline into the code, the anaconda ipython works correctly now. But if I replace the %matplotlib inline with %pylab, the anaconda ipython died again.

Note: I use the python 2.7. System ipython's version is 2.3, anaconda ipython's version is 3.2.

like image 458
Yantao Xie Avatar asked Oct 10 '15 08:10

Yantao Xie


People also ask

What is QT XCB?

On Linux, the xcb QPA (Qt Platform Abstraction) platform plugin is used. It provides the basic functionality needed by Qt GUI and Qt Widgets to run against X11. Its library dependencies are described the following table.

How do I install Qt plugins?

Note: You can install only plugins that are supported by your Qt Creator version. To install plugins: Select Help > About Plugins > Install Plugins. In the Source dialog, enter the path to the archive or library that contains the plugin.

Where does Qt look for plugins?

In Qt, when an application starts, the application's executable directory is the base directory where Qt searches for plugins. For example, on Windows, if the application is in C:\Program Files\MyApp and it has a style plugin, Qt looks in C:\Program Files\MyApp\styles .


1 Answers

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 qt sudo ./conda remove pyqt sudo ./conda install qt sudo ./conda install pyqt 

Hope it helps!

like image 104
anto150192 Avatar answered Oct 13 '22 18:10

anto150192