PyQt5 on Windows in Python 2.7: Error importing QtWidgets - python

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)?

Related

ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory

When I am running my python program I am getting following error in my terminal.
Traceback (most recent call last):
File "./encryption.py", line 6, in <module>
from PySide6 import QtCore, QtWidgets, QtGui
ImportError: libOpenGL.so.0: cannot open shared object file: No such file or directory
How to solve it?
The import statements in my program are
#!/usr/bin/env python3
import sys
import random
import re
import pyAesCrypt
from PySide6 import QtCore, QtWidgets, QtGui
run the following command, to install libopengl0 library it required to run the code.
sudo apt install libopengl0 -y
The problem is a bug in PySide 6, which is apparently caused by a bug in Qt 6. Until that's fixed, you have to install OpenGL separately from installing PySide 6.
I installed it on Ubuntu 20.04 with this command:
sudo apt-get install freeglut3 freeglut3-dev

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

Can't get PyQt5 running

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.

PySide 2 installed successfully but not Shiboken 2

I have successfully managed to build and install PySide2 on Python 3.6.4. (default, not Anaconda) on Windows 10 operating system.
However shiboken2 has not been installed. How may I install shiboken2? I know that that the code for this module is attached to PySide2 installation files.
I suspect that my C++ code which is built as DLL file cannot be imported in Python due to missing shiboken2. However this importing works fine in Anaconda environment. But at the moment I do not want to use Anaconda because there are old versions of 'Qt' (5.6 but I need 5.9.x) and 'PySide2' installed.
Just a moment ago I figured it out that shiboken2 can be imported like this:
from PySide2 import shiboken2
So before importing my own files the above line has to be added.

Eric 6 Python IDE Qt version Error

I want to setup Eric 6 IDE on Linux Mint 17.1. I downloaded source code of Eric 6 and I tried to setup.
sudo python3 install.py
I got an Qt version error on the below.
Checking dependencies
Python Version: 3.4.0
Found PyQt5
Found QScintilla2
Found QtGui
Found QtNetwork
Found QtPrintSupport
Found QtSql
Found QtSvg
Found QtWebKit
Found QtWebKitWidgets
Found QtWidgets
Sorry, you must have Qt version 4.8.0 or better or 5.3.0 or better.
But when I controlled QT version on my computer. Output is on the below.
QMake version 3.0
Using Qt version 5.4.0 in /usr/lib/x86_64-linux-gnu/qt5/lib
How can this be fixed?

Categories