Can't get PyQt5 running - python

i downloaded this:
https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6/
and when running any example scripts, I get a module not found error like this:
File "C:\Program Files (x86)\Python36-32\Lib\site-packages\PyQt5\examples\dialogs\classwizard\classwizard.py", line 45, in <module>
from PyQt5.QtCore import QDir, QFile, QRegExp
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.`
I read this post and added the env variable:
PyQt5 module cant be found after installing PyQt5 with Installer
Could it be because I am using Python 3.6.5. and the installer is for Python 3.5 ? or do I have to install anything additional? I doubt that because the installer said it installs PyQt, Qt and other tools.

Related

Can't start spyder because of PyQt5.QtWebKitWidgets

I have a problem with spyder.
I just installed on this laptop Python 3.7 and Spyder, as I did on many others. However this time, it doesn't work.
I installed Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 with the installer. I changed the path to a custom path: C:\Python\Python37, I added the precompile library and I added the path to the environment.
The laptop was rebooted at that point.
Then I updated pip:
py -3.7 -m pip install --upgrade pip
And then I installed spyder:
py -3.7 -m pip install spyder
I then try to launch spyder with the file:
C:\Python\Pythno37\Lib\site-packages\spyder\app\start.py
I get the error:
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'
PyQt5 is installed with version 5.12.
No clue why it doesn't work...
EDIT: The full error message:
It sugggest that the problem comes from qtpy. However, the corresponding file imports:
from . import PYQT5,PYSIDE2, PYQT4, PYSIDE, PythonQtError
# To test if we are using WebEngine or WebKit
WEBENGINE = True
if PYQT5:
try:
from PyQt5.QtWebEngineWidgets import QWebEnginePage
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWebEngineWidgets import QWebEngineSettings
except ImportError:
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
from PyQt5.QtWebKitWidgets import QWebView as QWebEngineView
from PyQt5.QtWebKit import QWebSettings as QWebEngineSettings
WEBENGINE = False
The PyQt5.QtWebEngnieWidgets is correctly used.
I swapped Pyqt5 version from 5.12 to 5.11.2 with:
py -m pip install pyqt5==5.11.2
And now it works...
Three days ago I was playing around with Python, Mayavi and Jupyter Notebooks to create visualizations. This required to install PyQt5.
Due to constantly reaching memory errors, I've decided to test without using virtualenv's and installed the needed requirements on my local environment (which of course didn't solve).
After that, I was on my way to create visualizations using matplotlib and other Python libraries but can't launch Spyder from the Anaconda Navigator.
This is the error showing up, which is similar to yours
Traceback (most recent call last):
File "C:\Users\tiago\Anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 22, in
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\tiago\Anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\tiago\Anaconda3\lib\site-packages\spyder\app\start.py", line 186, in main
from spyder.app import mainwindow
File "C:\Users\tiago\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 90, in
from qtpy import QtWebEngineWidgets # analysis:ignore
File "C:\Users\tiago\Anaconda3\lib\site-packages\qtpy\QtWebEngineWidgets.py", line 26, in
from PyQt5.QtWebKitWidgets import QWebPage as QWebEnginePage
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'
The correct answer didn't work in my case.
This problem had to do with the PyQt5 installation. The way to fix it was to uninstall it
pip uninstall PyQt5
and then Spyder launched perfectly

Pyqt5 is installed but gives dll failed to load error on import?

So, I tried to install PyQt5(version 5.7.1) for my miniconda3(python version 3.5.1) with pip install PyQt5 and it shows up when I try conda list in console:
But no pyqt5 program is running and when I import something like:
from PyQt5.QtWidgets import QApplication
its gives an ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
How can I fix this? Do I have to install C++ and Qt lib for C++ for this to work?? Please Help!
I know it's an old question, i've found solution that worked for me, maybe it will be useful for somebody else.
conda list
should contain pyqt PyQt5 and qt. If any of it are not there, you need to install it - run:
conda install qt, for example.
I see in the question there is pyqt and PyQt5 installed, but is there qt?

pyqt is installed but it won't import (Mac)

I installed PyQt4 and I have xcode, Qt, Sip, and Python 2.7. When I check in terminal, it says that PyQt is installed and when I view the path there is no PyQt in the path. I have put it in the path before but it goes away when I close the shell. When I try and import it it says no module named PyQt4. Help
brew install pyqt
Warning: pyqt-4.11.4 already installed
>>> for f in sys.path:
print f
/Users/lucygrant/Documents
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Python/2.7/site-packages
>>> import PyQt4
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import PyQt4
ImportError: No module named PyQt4
Assuming that adding PyQt4 to PATH solved your problem before, do it again except now do it in the ~/.bashrc file. So, as follows:
Add PyQt4 to PATH in ~/.bashrc as you have previously done.
source ~/.bashrc from command line.
Reattempt import

PyQt5 on Windows in Python 2.7: Error importing QtWidgets

I downloaded PyQt5 executable file on Windows 7 for python 2.7 both 64bit versions.
Is installed on C:\Python27\Lib\site-packages\PyQt5
I'm trying to use the above code:
from PyQt5.QtWidgets import QApplication, QDialog
I get the error:
ImportError: DLL load failed: The specified module could not be found.
I found the QtWidgets on this folder: C:\Python27\Lib\site-packages\PyQt5\sip\PyQt5\QtWidgets
Do you have any idea?
Are you sure that you installed a version of PyQt5 that is compatible with your version of Python (32-bit or 64-bit)?

Ghost.py not finding PySide?

I'm trying to get started with the Ghost.py headless browser on a Mac. I installed Ghost.py and its dependencies using these links/commands:
Qt 5.0.1 for Mac, has a GUI installer
PySide 1.1.0, which requires Qt Version >= 4.7.4, has a GUI installer
sudo pip install Ghost.py
I launched Python, and confirmed that I can import PySide. However, when I do from ghost import Ghost, it fails to find PySide:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/__init__.py", line 1, in <module>
from ghost import Ghost
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/ghost.py", line 28, in <module>
raise Exception("Ghost.py requires PySide or PyQt")
Exception: Ghost.py requires PySide or PyQt
By doing import PySide; print PySide;, it appears that PySide is installed here on my system: /Library/Python/2.7/site-packages/PySide. So, appended the PYTHONPATH like this:
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages #for PySide.
However, Ghost.py still cannot find PySide.
How can I convince Ghost.py to find my installation of PySide?
Environment:
Mac OS X 10.7.5
Python 2.7
Qt 5.0.1
PySide 1.1.0
I faced the exact same problem but managed to fix it. Here is how:
Uninstall the current installation of PySide and qt on your system. Make sure PySide is not present in /Library/Python/2.7/site-packages.
Install qt and PySide from http://qt-project.org/wiki/PySide_Binaries_MacOSX.
PS: My system is running 10.9 (Mavericks) but I think it should work in 10.7 (Mountain Lion) as well.

Categories