Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

While importing PyQt4.QtGui gets ImportError: DLL load failed: The specified procedure could not be found [duplicate]

Tags:

python

qt

pyqt4

I have a working Python 2.6 install and just installed the PyQt4 built for Python 2.6 (available at http://www.riverbankcomputing.co.uk/software/pyqt/download). When I try to import PyQt4.QtGui I get the following error:

ImportError: DLL load failed: The specified procedure could not be found.

I'm on Windows 2k8 64-bit, but my Python install is 32-bit.

like image 627
Rock Hymas Avatar asked Apr 29 '10 16:04

Rock Hymas


6 Answers

Add the the PyQt4 directory containing Qt's applications and DLLs to your PATH environment variable. In PowerShell, provided you didn't change any of your install paths, that'd be

$env:path += ';C:\Python26\Lib\site-packages\PyQt4\bin'
like image 66
Benjamin Pollack Avatar answered Oct 03 '22 04:10

Benjamin Pollack


I found a solution on another forum that worked for me. I needed to copy QtGui4.dll and QtCore4.dll into the ...\Python2.7.1\Lib\site-packages\PyQt4 directory. Note, I left the original in the bin directory.

like image 22
frustatedFriend Avatar answered Oct 03 '22 05:10

frustatedFriend


I had installed PyQt4 from a .whl file (from the unofficial windows binaries) and got the same error.

I did what the answers suggested: checked that I installed the correct version, put my PyQt4 directory in the PATH environment variable and had QtCore4.dll and QtGui4.dll, however none of these worked.

The answer was to try and open the designer.exe program: it also had an error, but this time specified which DLL file was missing (it said msvcp140.dll is missing from your computer)

I then downloaded it off dll-files.com and put it in the PyQt4 folder (C:\Python35\Lib\site-packages\PyQt4) and it worked.

I hope this helps !

like image 22
TrakJohnson Avatar answered Oct 03 '22 03:10

TrakJohnson


Are you sure you installed Python x64 ? By default, the Python website makes you download the x32 version, you need to go to this page to download the x64 version and then it will work. I had the same issue and it was fixed this way. https://www.python.org/downloads/windows/

Hope that will help someone. Cheers, Chris

like image 23
Chistof Avatar answered Oct 03 '22 05:10

Chistof


If this does not works, try search for QtCore4.dll, QtGui4.dll, etc. in your paths set in PATH environment variable. In my case I found some qt dll in c:\windows\system32, caused the same error message. I've deleted the dll files, and problem solved. 'C:\Python26\Lib\site-packages\PyQt4\bin' was in my path, but that was not enough.

like image 38
Ivan Marinov Avatar answered Oct 03 '22 04:10

Ivan Marinov


Neither of the these solutions worked for me. I had Python 3.1 x64 with PyQt 4.8.2-1 x64 on my Windows 7 x64, but uninstalling them and installing the x86 versions of Python 3.1 and PyQt solved the problem for me.

like image 23
alexteg Avatar answered Oct 03 '22 05:10

alexteg