navis-org / pymaid

Python library to interface with CATMAID servers. Fully interoperable with navis.
https://pymaid.readthedocs.io/en/latest/
GNU General Public License v3.0
23 stars 11 forks source link

SOLVED: "Could not load the Qt platform plugin "xcb" in "" even though it was found" #204

Open jasper-tms opened 3 years ago

jasper-tms commented 3 years ago

I was building a new pymaid virtualenv and ran into a very weird error that I was eventually able to solve. Posting here in case it helps others. I was getting the following error when trying to run import pymaid in an ipython session:

$ ipython
Python 3.7.9 (default, Aug 18 2020, 06:24:24) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pymaid
In [2]: WARNING: Could not load the Qt platform plugin "xcb" in "" even though it was found.
WARNING: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
$ 

Interestingly this crash did NOT happen when running in a python session despite happening in ipython sessions. No clue why. Also no clue why I hadn't gotten this error previously, since I've had pymaid virtualenvs before on this computer and been able to import pymaid in ipython just fine. My hunch is that my computer installed some system updates at the same time as I was remaking my virtualenv, and that the emergence of this crash mode was due to some system stuff changing and not actually related to any differences between my new and old virtualenvs, but I can't be sure. Anyway, I solved the problem via sudo apt install libxcb-xinerama0 as suggested here. Other things I had tried: Using pip to uninstall and reinstall maplotlib, pyqt5, or pyqt5-sip did not solve the issue.

I'm on Linux 16.04, and was using pymaid 1.1.2. If anyone has some insight into what this error is about, or if anyone else is able to reproduce the issue and do more tinkering, feel free to share.

schlegelp commented 3 years ago

Thanks Jasper! Will leave the issue open in case anybody else stumbles over this. Might also add it to the trouble-shooting section of the docs.

jasper-tms commented 3 years ago

This problem just popped up for me on another machine, again Ubuntu 16.04, but this time Python 3.6.12 and when trying to import navis instead of import pymaid. sudo apt install libxcb-xinerama0 again solved the problem. So presumably the migration of functions from pymaid to navis means this is now a problem navis users may encounter sometimes.