Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve for "ImportError: DLL load failed: The specified procedure could not be found" for PyQt5.QtWidgets #10079

Open
temp89 opened this issue Sep 18, 2018 · 11 comments

Comments

@temp89
Copy link

temp89 commented Sep 18, 2018

Actual Behavior

Fresh install on Win 10 x64
run Anaconda Navigator, Spyder, or try to launch any of the applications and it fails with:

Traceback (most recent call last):
File "D:\Python\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "D:\Python\lib\site-packages\spyder\app\start.py", line 190, in main
from spyder.app import mainwindow
File "D:\Python\lib\site-packages\spyder\app\mainwindow.py", line 80, in
from qtpy.compat import from_qvariant
File "D:\Python\lib\site-packages\qtpy\compat.py", line 15, in
from .QtWidgets import QFileDialog
File "D:\Python\lib\site-packages\qtpy\QtWidgets.py", line 22, in
from PyQt5.QtWidgets import *
ImportError: DLL load failed: The specified procedure could not be found.

After much googling this seems to be a very common issue. Past solutions include the absence of python3.dll (now included in the install) and overly long install directory addresses with non-standard characters. However these solutions do not work for many users.

Given how many inexperienced users are searching for a solution I thought it best to register one here for convenience (and hopefully a fix will be included in the next update).

Fix

On a fresh install, browse to the install directory and enter:

python -m pip install --upgrade pyqt5

Bear in mind this will not work if you ran:

conda update --all

to get the latest versions of all the modules. If you have, then enter:

python -m pip uninstall pyqt5
python -m pip install --upgrade pyqt5

Anaconda or Miniconda version:

Anaconda 5.2 for Python 3.6

@WhisperOfHeart
Copy link

I run into this problem also. And fix it by browsing to the install directory and entering:
python -m pip install --upgrade pyqt5==5.9
in the Anaconda Prompt by Administer.
Directly entering
python -m pip install --upgrade pyqt5
will install pyqt5 version>5.10 which may not compatible with others.
By the way, I found in the edition Anaconda3-5.2.0-Windows-x86,
conda update --all
works.
And maybe installing x64 Anaconda in win10 x64 will not run into this problem.

@norweeg
Copy link

norweeg commented Mar 18, 2019

does downgrading your qt version work?
edit: nope. Starting to question why I bother with conda anymore. Something always breaks in my environment every time I use it and bugs like this go unpatched for months

@norweeg
Copy link

norweeg commented Mar 22, 2019

found a solution: Anaconda had to be added to my PATH. Executing my script from anywhere but the Anaconda terminal, even in VS Code with the Anaconda Extension installed and the option to activate the environment in all python terminals set, it was not able to find the Qt installation unless %CONDA_PREFIX%\Library\bin was in my path

@sha-fuq
Copy link

sha-fuq commented Apr 6, 2019

found a solution: Anaconda had to be added to my PATH. Executing my script from anywhere but the Anaconda terminal, even in VS Code with the Anaconda Extension installed and the option to activate the environment in all python terminals set, it was not able to find the Qt installation unless %CONDA_PREFIX%\Library\bin was in my path

This solved my issue. Thanks!

@SushanthDC
Copy link

When using tensorflow, the ImportError: DLL load failed error, there are many reasons, up from the google.protobuf.pyext import _message error, it should be the protobuf version of the problem,

When tensorflow is automatically installed, protobuf installs the latest version 3.7.1, and there is an incompatibility problem.

Replace with protobuf 3.6.1 (pip install protobuf==3.6.1)

@Jichen66
Copy link

python -m pip install --upgrade pyqt5

this one works for me. Thx @temp89

@emaadshamsi
Copy link

Hello, I am a python novice here, and I am running into a similar problem, however it has to deal with PySide2 instead of PyQt5 and I just wanted to know, what is the install directory that you guys are refering to exactly? Is it C:\ProgramData\Anaconda3\pkgs?? Do I just open up the powershell and run the commands you guys mentioned from inside that directory?

I have been running into this DLL load issue forever and I legitimately have no idea how to fix it, this is the closest I have gotten.

@titan36
Copy link

titan36 commented Nov 4, 2021

#10079 (comment)
Solved my Problem

@KeineGosu
Copy link

This solved my problem. Created this account to thank you!

@rokm33
Copy link

rokm33 commented Nov 29, 2022

conda update --all
Solved my problem. Thanks @temp89

@EloySerrudo
Copy link

Thank you so much!!
"conda update --all" Solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests