How to use PyQt4 with Python 3.6? - python-3.x

I need to import PyQt4.QtGui, PyQt4.QtCore and PyQt4.QtWebKit for my script.
since i couldnt find a 3.6 version of PyQt4, i used the latest PyQt4 release i got:
PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64
When i tried to run my script it says
from PyQt4.QtGui import *
ImportError: DLL load failed: module not found.
i tried several "solutions" and read everything i found, but until now nothing helped.
Can't PyQT4 (x64) be used under Win10 Home with Python 3.6 (x64) being installed?
Or did i miss something?

Related

PyInstaller weird PyQt5.sip import causes a failed EXE [duplicate]

After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets
from PyQt5.QtWidgets import *
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
Any idea on how can I solve this issue?
The reason is a backward incompatible change in PyQt-5.11
In geoptics this fix works on old and new versions:
try:
# new location for sip
# https://www.riverbankcomputing.com/static/Docs/PyQt5/incompatibilities.html#pyqt-v5-11
from PyQt5 import sip
except ImportError:
import sip
As suggested here pyuic5 - ModuleNotFoundError: No module named PyQt5.sip
Try uninstalling and re-installing all PyQt related libraries:
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine
Then install them again, this will fix:
ModuleNotFoundError: No module named 'PyQt5.sip'
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python<PYTHON-VERSION>\Lib\site-packages and manually delete the PyQt folders, them uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)
If you're building sip and PyQt5 from source using make files, make sure to check PyQt5 install docs. In particular,
Note
When building PyQt5 v5.11 or later you must configure SIP to create a
private copy of the sip module using a command line similar to the
following:
python configure.py --sip-module PyQt5.sip
If you already have SIP installed and you just want to build and
install the private copy of the module then add the --no-tools option.
You should add PyQt5.sip to hidden imports; that should solve the issue.
I repaired this problem
This problem occurred when upgrading pyqt5 version 5.15.0
There was no problem when I reverted to the previous version.
I have
python -V: 3.7.4
PYQT5 5.14.1 and PYSIDE 5.14.1 works fine
In addition to the answer provided by Tadeu (https://stackoverflow.com/a/58880976/12455023) I would also suggest checking version of your libraries to make sure that they match.
Use pip show <library_name>
This will help you to make sure that no earlier installation is conflicting with your current installation.
In place of library_name use PyQt5, PyQt5-sip, PyQtWebEngine. If any of them is present in the system, then use pip uninstall <library_name>==<version_number> to remove that library.
Once you made sure that no other versions of these libraries are there, then you can reinstall the preferred version of that library.

I can't figure out how to install PyQt5

I am not a pro, just an amateur enthusiast trying to level up. Apparently I am missing something when it comes to installing PyQt5. In the effort to do so I have gone through several versions of python, and screwed up PyCharm such that it basically doesn't run even my old stuff.
I currently have a 64 bit Python 3.5 and a 32 bit python 3.6 installed. I couldn't figure out where the install file on the latest PyQt5 was, so I used an exe version: PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe
All appeared well, but after this step PyCharm wouldn't work, so I got it to rediscover Python again, but now I get the error:
Traceback (most recent call last):
File "C:/Users/RFC/PycharmProjects/PyQt_learning/test.py", line 2, in <module>
from PyQt5 import QtCore, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'
So, any help would be greatly appreciated!
The first thing I suggest you do is uninstall and redownload the exe. Also after checking the website I have discovered that this version of PyQt5 is only compatible with Python 3.5 not 3.6.

Use PyQt5.QtWebEngineWidgets on Windows: is it possible?

I am trying to build an app in PyQt5 (version 5.6+) in Python 3.6. It contains a web browser, using QtWebEngineWidgets.
It works fine on Mac, however, there are problems on Windows.
When I run the code on Windows and import the module:
from PyQt5 import QtWebEngineWidgets
I get the following error:
ImportError: cannot import name 'QtWebEngineWidgets'
Now, reading some forums it looks like PyQt5.QtWebEngineWidgets is not available for Windows, yet. Is it correct?
How can I have a web browser window, then?
I found online I could use QtWebKit, but according to here it seems QtWebKit was removed in Qt5.6.
So what? Do I have to downgrade PyQt version?
I can't go under 5.6 in Python 3.6 anyway. Do I have to change Python version as well?
you can try one of these solution ,
install old version :
pip install PyQt5==5.11.3
or install :
pip install PyQtWebEngine
u can download PyQt5.6 from here:
https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6
QtWebKit got deprecated upstream in Qt 5.5 and removed in 5.6. Beacuse The QtWebEngineWidgets module is better than QtWebkit.
The example directory has many examples about QtWebEngineWidgets
Yes, its possible to use QtWebEngineWidgets on Windows.

How to get QtWebEngineView in ptqt5 using python 3.4 on windows?

I tried pyqt 5.5 but it's showing unused import...unable to find keyword qtwebengineview or qt webenginewidgets Thanks..appreciate your time
You can fix the issue now by updating to pyqt5.9,
pip install PyQt5 --update
should do the trick. Once it's installed you'll need to import it with:
from PyQt5.QtWebEngineWidgets import QWebEngineView

PyQt4, Python 3.4 on Windows 7

I ran the windows 64bit installer for PyQt4 pointing it to the python34 folder. Python is not in default location, so I added PYTHONPATH with D:\Program Files\Python34\Lib\site-packages\PyQt4
Added the import statement to my module: "from PyQt4 import QtGui". I execute and get: "from PyQt4 import QtGui ImportError: DLL load failed: The specified module could not be found."
I noticed that if I simply put import PyQt4 and use intellisense in IDLE there are only a few private methods visible.
Since I ran the installer, must I still perform a make? Readme references windows instruction that do not seem to be present on my machine.

Resources