0

Error description

I have an existing Conda environment with Python 3.8.16, and I have tried to install Spyder with: conda install spyder as well as with conda install -c conda-forge spyder, (not simultaneously) which installs Spyder 5.4.3.

Running spyder however outputs:

Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Aborted (core dumped)

Running it from Anaconda navigator gives:

Exit code: 134

N.B. Running Spyder from Anaconda navigator in base environment works fine! It also works fine in the problematic environment but on my laptop with Ubuntu 20.04.6, with the same Spyder version but conda 23.9.0.

I have found several related issues:

Rstudio fails to open with error "...could not find or load the Qt platform plugin "xcb""

Cannot open qcreator qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""

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

OpenCOR, "could not find or load the Qt platform plugin "xcb""

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

“Failed to load platform plugin ”xcb“ ” while launching qt5 app on linux without qt installed

https://github.com/NVlabs/instant-ngp/discussions/300

https://discuss.pixls.us/t/solved-could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found/17677/7

None of which have solved my issue. Most of them have users finding the solution to be installing a large variety of libxcb*packages.

I have tried:

sudo apt install libxcb1
sudo apt install libx11-xcb1
sudo apt install xcb
sudo apt install libxcb-*

I have also tried:

export QT_QPA_PLATFORM=minimal

as well as xcb, dxcb and vnc and setting it to "".

Setting:

export QT_DEBUG_PLUGINS=1

also gives no new additional information. Also, on my laptop, echoing any of these variables gives nothing, yet it works there.

At first glance, the issue seems to be that the path where it looks for xcb is "", but I don't know what variable to change. After some searching, I tried:

export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins

since echoing that variable gave nothing. However, echoing that in base also gives nothing, yet it works there.

This just resulted in the error:

Could not load the Qt platform plugin "xcb" in "/usr/lib/x86_64-linux-gnu/qt5/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: dxcb, xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.

Aborted (core dumped)

Update 1: Now, however, setting export QT_DEBUG_PLUGINS=1 shows a whole lot, where the last perhaps relevant lines are:

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/lord/anaconda3/envs/tir-top/bin/platforms" ...
Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libdxcb.so: (/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libdxcb.so: undefined symbol: _ZNK15QXcbIntegration28createPlatformVulkanInstanceEP15QVulkanInstance, version Qt_5_PRIVATE_API)
QLibraryPrivate::loadPlugin failed on "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libdxcb.so" : "Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libdxcb.so: (/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libdxcb.so: undefined symbol: _ZNK15QXcbIntegration28createPlatformVulkanInstanceEP15QVulkanInstance, version Qt_5_PRIVATE_API)"
Could not load the Qt platform plugin "xcb" in "/usr/lib/x86_64-linux-gnu/qt5/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: dxcb, xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.

Aborted (core dumped)

But I don't even know whether this is the correct path to set, and again, it seems these variables aren't even needed on my laptop.

Update 2: Creating a new environment and installing spyder there with

conda create -n spyd-test python=3.8.16
conda activate spyd-test
conda install spyder

works!

But for some reason, in my already existing environment with the same python version, it does not.

Other sys specs:

Ubuntu 22.04.3
spyder 5.4.3
spyder-kernels 2.4.4
conda 23.9.0
qt5dxcb-plugin (5.0.46+git20220314-1)
$ conda list | grep qt
pyqt                      5.15.9           py38hffdaa6c_5    conda-forge
pyqt5-sip                 12.12.2          py38h17151c0_5    conda-forge
pyqtwebengine             5.15.6                   pypi_0    pypi
pyqtwebengine-qt5         5.15.2                   pypi_0    pypi
qt-main                   5.15.8              h01ceb2d_12    conda-forge
qt-webengine              5.15.8               h27f4a20_2    conda-forge
qtawesome                 1.2.2            py38h06a4308_0  
qtconsole                 5.4.4                    pypi_0    pypi
qtpy                      2.4.0                    pypi_0    pypi
sphinxcontrib-qthelp      1.0.3              pyhd3eb1b0_0
conda list | grep spyder
pyls-spyder               0.4.0              pyhd3eb1b0_0  
spyder                    5.4.3            py38h06a4308_1  
spyder-kernels            2.4.4            py38h06a4308_0

Any help would be highly appreciated!

Christopher.L
  • 213
  • 1
  • 3
  • 12

1 Answers1

0

I was facing the same issue while running Anaconda on my Ubuntu system. After spending some time on the internet, I found out that the solution was lying in the version of pyqt5 being used. I re-installed a slightly downgraded version of pyqt5 using pip:

pip install pyqt5==5.14.2

and also pyqtwebengine using pip:

pip install pyqtwebengine==5.14

Now, it is working fine. I don't know the exact reason why I need to downgrade the pyqt5 in order to make it work, though.

vivek
  • 11
  • 3