Qt platform plugin windows ошибка как исправить python

I am getting the error «could not find or load the Qt platform plugin windows» while using matplotlib in PyCharm.

How can I solve this?

enter image description here

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

asked Feb 2, 2017 at 4:59

Daivik Paul's user avatar

4

I had the same problem with Anaconda3 4.2.0 and 4.3.0.1 (64-bit). When I tried to run a simple program that uses matplotlib, I got this error message:

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

Reinstalling the application may fix this problem.

Reinstalling didn’t fix it.

What helped was this (found here):
Look for the Anaconda directory and set the Libraryplugins subdir (here c:ProgramDataAnaconda3Libraryplugins) as environment variable QT_PLUGIN_PATH under Control Panel / System / Advanced System Settings / Environment Variables.

After setting the variable you might need to restart PyCharm, if the change does not have an immediate effect.


Even though after that the command line Python worked, TexWorks (which uses Qt as well) displayed an error message very much like it. Setting the QT_PLUGIN_PATH to the directory containing TexWorks’ Qt DLLs (here C:UserschrisAppDataLocalProgramsMiKTeX 2.9miktexbinx64) fixed the problem for both programs.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Feb 14, 2017 at 16:40

cxxl's user avatar

cxxlcxxl

4,8493 gold badges31 silver badges52 bronze badges

3

If you want to visualize your matplotlibs in an alternative way, use a different backend that generates the graphs, charts etc.

import matplotlib
matplotlib.use('TKAgg')

This worked for me.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Aug 17, 2018 at 11:27

rakidedigama's user avatar

2

If you are running PyQt5 and PySide2, this solved the problem for me:

Copy the following files:

Anaconda3Libsite-packagesPySide2pluginsplatformsqminimal.dll
Anaconda3Libsite-packagesPySide2pluginsplatformsqoffscreen.dll
Anaconda3Libsite-packagesPySide2pluginsplatformsqwindows.dll

to:

Anaconda3Librarypluginsplatforms

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Sep 11, 2018 at 18:16

Osama Adly's user avatar

Osama AdlyOsama Adly

5115 silver badges4 bronze badges

1

I tried the following at Anaconda’s prompt, and it solved this problem:

conda remove qt
conda remove pyqt 
conda install qt 
conda install pyqt

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Mar 4, 2018 at 5:25

silly's user avatar

sillysilly

8879 silver badges9 bronze badges

3

I found that this was being caused by having the MiKTeX binaries in my PATH variable; and the wrong Qt dll’s were being found. I just needed to re-arrange the PATH entries.

(Dependency Walker is such a useful tool.)

answered Apr 20, 2018 at 7:52

Richard Ayling's user avatar

I had a similar problem with PyCharm where things worked great in main run but not in debugger, getting the same error message. This happened for me because I had moved my Anaconda installation to a different directory. The debugger goes and checks a qt.conf file that is located at the same place as python. This location can be found by running import sys; print sys.executable. I found this solution through a pile of web searches and it was buried deep here. The qt.conf file needs to have correct paths for debugger to work.

My qt.conf files looks like this in notepad:

[Paths]
Prefix = E:/python/Anaconda3_py35/Library
Binaries = E:/python/Anaconda3_py35/Library/bin
Libraries = E:/python/Anaconda3_py35/Library/lib
Headers = E:/python/Anaconda3_py35/Library/include/qt

answered May 17, 2017 at 17:22

launchpadmcquack's user avatar

2

Just add a system variable:

QT_QPA_PLATFORM_PLUGIN_PATH

and set its value to

C:Python34Libsite-packagesPyQt4pluginsplatforms

Voilà. Done

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Aug 18, 2019 at 4:45

kunjung sherpa's user avatar

2

I have found a solution that worked for me. This solution includes a code snippet to add before you import any modules from Pyside2 or PyQt5 package. See «Qt platform plugin «windows» #2″ for more information.

This code snippet is from the link:

import os
import PySide2

dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

from PySide2.QtWidgets import *
'''
Your code goes here
'''

This solution works for PyQt5 and PySide2 modules.
I don’t know if it’s relevant but I added the QT_PLUGIN_PATH environment variable in the system before.

That solution enabled me to test PySide2 scripts in IDLE.

However, I faced the same error when I tried to run a bundled script (exe).

With some shallow debugging, it’s evident that plugin folder itself is missing. I fixed the problem by adding the plugin folder in the appropriate location:

C:Usersxxxx.spyder-py3My_QtProjectsProject 1distMyQt_1PySide2

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Aug 5, 2019 at 4:22

Sourabh Desai's user avatar

2

If the Pycharm console or debugger are showing «Could not find or load the Qt platform plugin windows», the Python EXE file may be located at a different location for the PyCharm interpreter. You might manually select it in File -> Settings -> Interpreter.

  1. Set the working directory: File -> Settings -> Build, Execution, Deployment -> Console -> Python Console -> Working directory. Set it to the parent directory where your all code exists.

  2. Open Control Panel -> System Settings -> Advanced System Settings -> Environment Variables -> New. Set the variable name QT_PLUGIN_PATH , Variable Directory: Users<Username>AppdataLocalContinuumAnaconda2Libraryplugins.

  3. Restart Pycharm.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Mar 8, 2018 at 14:14

Pranzell's user avatar

PranzellPranzell

2,22416 silver badges21 bronze badges

1

I solved it by:

  • Adding a path:

    Anaconda3Libsite-packagesPyQt5Qtbin to PATH.
    
  • Setting an environment variable:

    QT_PLUGIN_PATH as Anaconda3Libsite-packagesPyQt5Qtplugins or Anaconda3Libraryplugins.

  • Also, you can try:

    pyqt = os.path.dirname(PyQt5.__file__)
    os.environ['QT_PLUGIN_PATH'] = os.path.join(pyqt, "Qt/plugins")
    

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered May 9, 2020 at 2:37

Zhongbo Chen's user avatar

1

First, use the command:

conda remove pyqt qt qtpy

Then install using:

conda install pyqt qt qtpy

This worked for me.

jdaz's user avatar

jdaz

5,9142 gold badges22 silver badges33 bronze badges

answered Jul 15, 2020 at 4:21

美利坚节度使's user avatar

1

Copy the folder

Anaconda3Librarypluginsplatforms

to

$

where $ is your project interpreter folder. For example:

"projectanaconda_envScripts"

because PyCharm calls the python.exe in this folder, not the one in Anaconda3.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Jan 15, 2019 at 16:13

sontran's user avatar

0

SOLUTION FOR WINDOWS USERS

Create new environment variable with:

name: QT_PLUGIN_PATH
path: C:yourpythonpathLibsite-packagesPyQt5Qtplugins

after that exe file will work

answered Apr 10, 2019 at 16:59

Pawel's user avatar

PawelPawel

271 bronze badge

1

On Windows:

  1. Copy the folder platforms:

    C:Users%USERNAME%AppDataRoamingpyinstallerbincache00_py35_64bitpyqt5qtpluginsplatforms 
    
  2. Paste the folder platform into the folder location of the file .exe:

    Example:

    c:MyFolderyourFile.exe
    c:MyFolderplatforms
    

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Aug 30, 2018 at 12:27

Daniel G's user avatar

0

You may need to copy the «plugins» file in Anaconda3Library. For example, on my computer it is

S:Anaconda3Libraryplugins

to the same path of your .exe file.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Aug 16, 2017 at 15:31

C.Conley's user avatar

copy the plugins from PySide2 and paste and overwrite the existing plugins in Miniconda worked for me.

(base) C:ProgramDataMiniconda3Libsite-packagesPySide2pluginsplatforms>copy *.dll  C:ProgramDataMiniconda3Librarypluginsplatforms

answered Aug 17, 2020 at 4:33

yptheangel's user avatar

1

I had the same problem with Anaconda. For me, although not very elegant, the fastest solution was to unistall and reinstall Ananconda completely. After that, everything worked well again.

answered Jul 30, 2021 at 7:55

Nils's user avatar

I have the same issue and fixed in this way
In Anaconda installation folder I went to : (change it to your installed path):
C:ProgramDataAnaconda3Libsite-packagesPySide2
Edit this file by adding the following code lines :

# below the line 23 type.__signature__
    pyside_package_dir =  os.path.abspath(os.path.dirname(__file__))
    dirname = os.path.dirname(__file__)
    plugin_path = os.path.join(dirname, 'plugins', 'platforms')
    os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

save this file and try again and the issue should be gone :)

answered Jun 9, 2020 at 4:13

Abdelrahman Farag's user avatar

I had the same issue. Following «Activating an environment» in «Managing environments» solved the issue.

In the command line:

conda activate myenv

where myenv=base for my setup.

the Tin Man's user avatar

the Tin Man

158k42 gold badges214 silver badges303 bronze badges

answered Dec 11, 2019 at 16:17

Pier-Yves Lessard's user avatar

Please try this in the script

qt_path= os.path.dirname(PyQt5.__file__)
os.environ['QT_PLUGIN_PATH'] = os.path.join(qt_path, "Qt/plugins")

answered Dec 22, 2020 at 4:01

Ammar Nourallah's user avatar

I know everyone above had provided various ways to fix OP’s issue. I just want to add on some suggestions.

By adding the QT_PLUGIN_PATH = C:Users{YOUR_USERNAME}Anaconda3Libraryplugins as your local machine environment variable it helps to fix OP’s PyCharm issue above. However, this will break other systems in your machine like: Dropbox reports missing QT, AMD settings fails to launch(which happens on my side) etc.

Instead of adding QT_PLUGIN_PATH to your machine locally, one can add the environment variable in PyCharm’s python interpreter setting as shown below:
enter image description here

This method not only allow your PyCharm’s python.exe able to search those DLLs but also not breaking other systems’ QT lookup PATH.

Thanks

Dharman's user avatar

Dharman

30.5k22 gold badges84 silver badges133 bronze badges

answered Jan 2, 2021 at 8:51

IvanPy's user avatar

1

I installed a package that had a QT-gui that I didn’t need.

So I just removed all the Qt modules from my environment.

pip freeze | grep -i qt

PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
QtPy==1.9.0

pip uninstall PyQt5
pip uninstall PyQt5-Qt5
pip uninstall PyQt5-sip
pip uninstall QtPy

Problem solved.

answered May 25, 2021 at 4:53

Duane's user avatar

DuaneDuane

4,4626 gold badges32 silver badges33 bronze badges

if you are using anaconda/miniconda with matplotlib installed.
you’ll have to install uninstall anaconda/miniconda and use miniconda without matplotlib, a fix is to use normal python not anaconda.

it has be a know issue here enter link description here

answered Mar 30, 2022 at 14:12

ironmann350's user avatar

ironmann350ironmann350

3712 silver badges4 bronze badges

Inspired by Osama Adly, I think this kind of problems are all caused by Anaconda configuration for Qt DLLs on Windows platform.
Just try to install PyQt/PySide in an empty environment besides Anaconda, for example a standalone Python program. You will find that the plugins about platforms are in the site-package directory itself.
For comparation:

site-packagesPyQt6Qt6pluginsplatforms
site-packagesPySide6pluginsplatforms

But it seems that Anaconda contains some software depending on PyQt5 or Qt. Anaconda moves the platforms directory from PyQt5 to another folder and this folder might be contained in the PATH variable when using Anaconda.

Anaconda3Librarypluginsplatforms

This could lead to unneccessary problems. These DLLs reserve the same name across different generation of Qt. For example, when I tried PySide6 in a virtual environment created with Anaconda, its call for DLLs will mistakenly use the Qt5 DLLS rather than the DLLs in its folder.

answered Mar 29, 2022 at 7:00

Xiangqian Zhao's user avatar

1

In my situation, I did everything listed above and on other forum post:

  1. Copying and pasting files
  2. Adding system variables
  3. Uninstalling, downloading, and reinstalling programs
  4. Restarting the computer
  5. Enabling debugging mode
  6. Running the source code instead of the compiled program
  7. Running sfc /scannow

All of this did not work.
In my case, the solution was to update Windows.
The computer was apparently running a very outdated version of Windows (10?)
After 2-3 hours of installing the update, problem solved.
Source/Inspiration: https://www.partitionwizard.com/clone-disk/no-qt-platform-plugin-could-be-initialized.html

answered Nov 17, 2022 at 23:20

Amit Shah's user avatar

I had the same issue with Qt 5.9 example btscanner.exe. What works in my case is:

  1. Create a folder where is btscanner.exe ( my is c:tempBlueTouth )
  2. Run from command prompt windeployqt.exe as follow:
    c:qtqt5.9.0msvc2015binwindeployqt c:tempBlueTouth
    /* windeplyqt is the standard Qt tool to packet your application with any needed
    libraries or extra files and ready to deploy on other machine */

  3. Result should be something like that:

C:tempBlueTouthbtscanner.exe 32 bit, release executable
Adding Qt5Svg for qsvgicon.dll
Skipping plugin qtvirtualkeyboardplugin.dll due to disabled dependencies.
Direct dependencies: Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
All dependencies   : Qt5Bluetooth Qt5Core Qt5Gui Qt5Widgets
To be deployed     : Qt5Bluetooth Qt5Core Qt5Gui Qt5Svg Qt5Widgets
Warning: Cannot find Visual Studio installation directory, VCINSTALLDIR is not set.
Updating Qt5Bluetooth.dll.
Updating Qt5Core.dll.
Updating Qt5Gui.dll.
Updating Qt5Svg.dll.
Updating Qt5Widgets.dll.
Updating libGLESV2.dll.
Updating libEGL.dll.
Updating D3Dcompiler_47.dll.
Updating opengl32sw.dll.
Patching Qt5Core.dll...
Creating directory C:/temp/BlueTouth/iconengines.
Updating qsvgicon.dll.
Creating directory C:/temp/BlueTouth/imageformats.
Updating qgif.dll.
Updating qicns.dll.
Updating qico.dll.
Updating qjpeg.dll.
Updating qsvg.dll.
Updating qtga.dll.
Updating qtiff.dll.
Updating qwbmp.dll.
Updating qwebp.dll.
Creating directory C:/temp/BlueTouth/platforms.
Updating qwindows.dll.
Creating C:tempBlueTouthtranslations...
Creating qt_bg.qm...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_da.qm...
Creating qt_de.qm...
Creating qt_en.qm...
Creating qt_es.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_gd.qm...
Creating qt_he.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_pl.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
  1. If you take e look at c:tempBlueTouth folder will see
    the folders iconengines, imageformats, platforms, translations,
    and files D3Dcompiler_47.dll, libEGL.dll, libGLESV2.dll, opengl32sw.dll,
    Qt5Bluetouth.dll, Qt5Core.dll, Qt5Gui.dll, Qt5Svg.dll, Qt5Widgets.dll
    .

These are all of the files and folders need to run btscanner.exe on
this or another machine. Just copy whole folder on other machine and
run the file.

Nikolai  Shevchenko's user avatar

answered Sep 24, 2019 at 13:27

SPirev's user avatar

0

copy platforms from Anaconda3Libraryplugins and put it in the Anaconda3.
for env put the platforms in the specific env folder

answered Jul 31, 2019 at 21:31

aawan's user avatar

Ошибка при запуске примеров, использующих PyQT5

Андрей Широков

Здравствуйте. У меня при запуске простейших примеров на Python (в PyCharm) возникает ошибка: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Хотя и PyQT5 и PyQT5-tools (с дизайнером) установлены. Переустанавливать пробовал, не помогает.
При запуске из командной строки: qt.qpa.plugin: Could not find the Qt platform plugin «windows» in «» This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

1 чел.

Cannot instantiate a QApplication.

import sys
from PyQt5 import QtWidgets

app = QtWidgets.QApplication(sys.argv)

Results in:

This application failed to start because it could not find or load the Qt platfo
rm plugin "windows".

Available platform plugins are: minimal (from C:Python27libsite-packagesPyQt
5pluginsplatforms), offscreen (from C:Python27libsite-packagesPyQt5plugin
splatforms), windows (from C:Python27libsite-packagesPyQt5pluginsplatform
s).

Reinstalling the application may fix this problem.

Having encountered the problem in the past, I could solve it by appending the plugins by hand like this:

import os
import sys

import PyQt5

dirname = os.path.dirname(PyQt5.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

from PyQt5 import QtWidgets
app = QtWidgets.QApplication(sys.argv)

However this produces the same error. The odd thing is that it says it can’t load the plugin, and then lists the plugin as one of the available ones. Maybe a permission issue? Yet permissions on the files are unlocked and even replacing it with the source original from the Qt installation yields the same results. Removing the plugin from the directory correctly removes it from plugins found.

depends.exe

Running depends on qwindows.dll yields a few interesting results.

depends

However each of these are available directly within the PyQt5 Python package directory.

It works

If keeping the original installation of Qt on the PATH, PyQt5 seems to work. From a terminal:

# Keeping C:QtQt5.3.05.3msvc2013_64bin on the PATH

import os
import sys

from PyQt5 import QtWidgets
app = QtWidgets.QApplication(sys.argv)
button = QtWidgets.QPushButton("Hello World")
button.show()

So there must be something within this directory which is requited by PyQt5. But copying the entire contents into the PyQt5 Python library directory yields no better results.

I am implementing qgis 3.4.3 in a custom application, but when I instantiate the QgsApplication() class, I receive the error «Could not find the Qt platform plugin «Windows» in «».

I’ve attempted using various installs of qgis 3.x+ including the standalone installer and OSGeo4W web installer. I currently am sticking with the OSGeo4W web installer installation. I am using a Python 3.7 installation separate from what comes with OSGeo4W and attempting to integrate qgis functionality.

I have followed the instructions in the following QGIS help doc under the section: «Using PyQGIS in Custom Applications»
https://docs.qgis.org/2.18/en/docs/pyqgis_developer_cookbook/intro.html#run-python-code-when-qgis-starts

After attempting to run the script I realized a dll plugin was missing. After some research, I found its the qwindows.dll that qt uses. The qwindows.dll is included in the OSGeo4W installation under: C:OSGeo4WappsQt5pluginsplatforms

I changed the QT_PLUGIN_PATH variable on the local command prompt to include the directory above, but the same error prevailed. I also changed the QT_DEBUG_PLUGINS variable to 1 which printed out the locations Qt is looking for plugins. Interestingly, it wasn’t looking for plugins in the path I specified in the QT_PLUGIN_PATH variable.

Python Code:

import sys
#add qgis python libraries to instance python path in case not added 
#at the environment variable %PYTHONPATH% level
sys.path.extend(['C:\OSGeo4W\apps\qgis\python', 
'C:\OSGeo4W\apps\Python37\Lib\site-packages'])

from qgis.core import *

# supply path to qgis install location
QgsApplication.setPrefixPath('C:\OSGeo4W\apps\qgis', True)

# create a reference to the QgsApplication
# setting the second argument to True enables the GUI, which we need to do
# since this is a custom application
qgs = QgsApplication([], True)

# load providers
qgs.initQgis()

# Write your code here to load some layers, use processing algorithms, etc.

# When your script is complete, call exitQgis() to remove the provider and
# layer registries from memory
qgs.exitQgis()

Batch File Code to Start Cmd Prompt with Proper Variables:

@echo off
SET OSGEO4W_ROOT=C:OSGeo4W
::Include environment variables set by qgis on startup
call %OSGEO4W_ROOT%bino4w_env.bat
call %OSGEO4W_ROOT%binqt5_env.bat
call %OSGEO4W_ROOT%binpy3_env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%appsqgisbin
path %PATH%;C:OSGeo4WappsQt5bin
path %PATH%;C:OSGeo4WappsPython37Scripts
path %PATH%;C:OSGeo4WappsPython37

set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%appsqgispython
set PYTHONHOME=%OSGEO4W_ROOT%appsPython37
set QT_PLUGIN_PATH=%OSGEO4W_ROOT%appsQt5plugins;%OSGEO4W_ROOT%appsqgisqtplugins
set QT_DEBUG_PLUGINS=1

cmd.exe

I expect to run the python script and receive no errors since I’m pointing to the directory where the qwindows.dll missing plugin is stored. However, I am still receiving the missing windows plugin error.

Here is the actual message with QT_DEBUG_PLUGINS set to 1:
QFactoryLoader::QFactoryLoader() checking directory path «C:/OSGeo4W/apps/qgis/qtplugins/platforms» …
QFactoryLoader::QFactoryLoader() checking directory path «C:/OSGeo4W/apps/Python37/platforms» …
qt.qpa.plugin: Could not find the Qt platform plugin «windows» in «»
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

I am stuck trying to run a very simple Python script, getting this error:

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

zsh: abort      python3 mypuppy1.py

The script code is:

import cv2
img = cv2.imread('00-puppy.jpg')
while True:
    cv2.imshow('Puppy',img)
    if cv2.waitKey(1) & 0xFF == 27:
        break
cv2.destroyAllWindows()

However this Notebook code works in JupyterLab:

import cv2
img = cv2.imread('00-puppy.jpg')
cv2.imshow('Puppy', img)
cv2.waitKey()

I am on macOS, using Anaconda and JupyterLab. I would appreciate any help with this issue. Thanks!

Hagbard's user avatar

Hagbard

3,3804 gold badges26 silver badges63 bronze badges

asked Feb 3, 2020 at 15:44

Nick Foley's user avatar

4

Try installing

pip3 install opencv-python==4.1.2.30  

answered Feb 18, 2020 at 16:53

kaizen's user avatar

kaizenkaizen

1,1221 gold badge13 silver badges20 bronze badges

1

For Ubuntu users,

sudo apt-get install qt5-default fixes the issue.

(I’m using OpenCV 4.4)

answered Dec 24, 2020 at 10:21

WhaSukGO's user avatar

WhaSukGOWhaSukGO

5657 silver badges17 bronze badges

3

For me, it worked by using a opencv-python version prior to 4.2 version that just got released. The new version (4.2.0.32) released on Feb 2, 2020 seems to have caused this breaking change and probably expects to find Qt at a specific location (Users/ directory) as pointed by other answers.

You can try either manually installed from qt.io as suggested and making sure you get a .qt directory under yours Users directory, or you can use version 4.1.2.30, which works like charm without doing anything else.

It works for opencv-contrib-python too.

Rajesh shanmugam's user avatar

answered Feb 10, 2020 at 15:34

Simran Singh's user avatar

0

This can be solved installing python-opencv-headless instead of python-opencv

answered Feb 18, 2020 at 13:33

Nicochidt's user avatar

3

Same issue here. No answer, but it’s appearing in a similar setup. I’ve tried throwing many solutions at it:

  • Installing QT from brew,
  • Reinstalling from: qt.io/download-qt-installer
  • Installing from pip (using virtual environments)
  • Explicitly setting changing the environment variables
    • QT_PLUGIN_PATH=»/Users/halopend/.qt/5.14.1/clang_64/plugins/»
    • QT_QPA_PLATFORM_PLUGIN_PATH=»/Users/halopend/.qt/5.14.1/clang_64/plugins/platforms/»

Sometimes the issue appeared to be opencv having qt included within it which classed with an externally defined qt, but I’m not sure.

Anyway, not sure if that will help you, but at least you have a few ideas of where to look.

answered Feb 6, 2020 at 1:36

Jean Fradet's user avatar

1

I met the same issue. I agree with Simran Singh. This issue comes from the recent update.

Quote from pacjin79 on Github:»If you are on a mac, make sure you install opencv-python-headless instead of opencv-python to avoid these errors.»
link

I personally solved the issue by doing so. Hope this works for you.

answered Feb 16, 2020 at 18:19

Victor Liu's user avatar

Through many trial and error, for me it works for uninstalling and installing numpy and opencv.

answered Jun 2, 2020 at 11:51

Calvin Khoo's user avatar

I was facing the same issue. Turns out in my case, python 3.9 was causing this conflict.
I managed to solve this by creating a new environment with python 3.8.

commands:

conda create -n myenv python=3.8.0
conda activate myenv
pip3 install opencv-python==4.2.0.34

lxhom's user avatar

lxhom

6203 silver badges15 bronze badges

answered Mar 13 at 6:39

Kaies Al Mahmud's user avatar

Facing the same issue with PyQt5 and solving it by using PyQt6==6.3.1 and opencv-python==4.6.0.66.

answered Aug 28, 2022 at 5:19

Benyamin Zojaji's user avatar

I ran into the same error after installing xrdp. The issue was solved after uninstalling xrdp and rebooting.

answered Feb 16 at 8:17

Amir's user avatar

In my case the solution from
this link
worked.

 export QT_QPA_PLATFORM=offscreen 

answered 2 days ago

akbarnejad's user avatar

  • Quake 4 ошибка unable to initialize opengl
  • Quik ошибка при обновлении
  • Qt platform plugin could be initialized ошибка как исправить
  • Quik ошибка подачи заявки
  • Qt designer ошибка при запуске