I had the same error and it was NOT related to display or X-server.
First, you need to debug the output of spyder
command:
export QT_DEBUG_PLUGINS=1
spyder
Cannot load library /home/fer/miniconda3/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/fer/miniconda3/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/fer/miniconda3/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: cannot open shared object file: No such file or directory)"
Could not load the Qt platform plugin "xcb" in "" even though it was found.
Now you have found that is something related to libqxcb.so
Check that with ldd
and you may found lots of not found
libs:
ldd /home/fer/miniconda3/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so
Install apt-file so that you can check which packages provide those missing files (for instance):
sudo apt install apt-file
sudo apt-file update
apt-file libxcb-icccm.so.4
apt-file search libxcb-icccm.so.4
apt-file search libxcb-util.so.1
apt-file search libxcb-image.so.0
apt-file search libxcb-keysyms.so.1
apt-file search libxcb-render-util.so.0
apt-file search libxcb-xkb.so.1
apt-file search libxkbcommon-x11.so.0
After having the name of the packages, install then:
sudo apt-get install libxkbcommon-x11-0 libxcb-xkb1 libxcb-render-util0 libxcb-keysyms1 libxcb-image0 libxcb-util1 libxcb-icccm4
Now, you should be ok, or at least you should have cleaned the path to the next error :-)
This method of debugging may be used in several similar problems in
the Linux world. Hope you enjoy it.