Use spyder 2 with KDE 4
I stumbled across a rather annoying inconvenience when using spyder 2 for python scripting and KDE as a desktop environment. Due to KDE and spyder both being qt-based, each software brings its own qt library, but unfortunately spyder (version 2.3.1) is build against another version of qt (namely 4.8.5) than kde, which ships with qt version 4.8.2. As a consequence you get the following error message if you try to start spyder:
Cannot mix incompatible Qt library (version 0x40802) with this library (version 0x40805)
[1] 19390 abort (core dumped) spyder
You can solve this problem by convincing spyder to use its own qt library by setting the environment variable QT_PLUGIN_PATH = ""
, i.e. deleting it. You can do so by adding two lines to spyder's bin file (mine is located under /opt/miniconda3/bin/spyder
because i installed spyder via anaconda):
import os
os.environ['QT_PLUGIN_PATH'] = ""
After adding them, the content of the file should look like this:
#!/opt/miniconda3/bin/python3
import os
os.environ['QT_PLUGIN_PATH'] = ""
from spyderlib import start_app
start_app.main()
After exporting this environment variable spyder starts just fine :).