Unresolved Import QtGui in Eclipse - python

I'm importing QtGui in Eclipse.
i.e.
from PyQt4 import QtGui
It is giving me error Unresolved Import QtGui. I'm unable to resolve this issue. Please give me solition to this problem.

Go to your Python x.x Folder in your C:\ and then go to Lib\site-packages then delete your PyQt Folder if there is any, then Download PyQt4 here:
Windows Link
Mac Link
Linux Link
Then Go a head and Start Building Awesome GUI!!

Make sure you installed PyQt4 before attemping to import it.
Download PyQT4 from here.

Related

PyCharm Error, ModuleNotFoundError: No module named 'PyQt5'

I installed python 3.7 and PyQt5 using pip install PyQt5 command. when I import the module in python console of pycharm, it is working alright but when I import it into my project files am getting the following error. I searched through the internet for possible solutions but are not working for me and I also think my problem is different from those that were already asked. any help?
from PyQt5 import QtCore, uic, QtWidgets
from PyQt5.uic import loadUi
from PyQt5.QtWidgets import QApplication,QDialog
import sys
UIClass, QtBaseClass = uic.loadUiType("projj/firstly.ui")
class MyApp(UIClass, QtBaseClass):
def __init__(self):
UIClass.__init__(self)
QtBaseClass.__init__(self)
self.setupUi(self)
self.setWindowTitle('developer in details')
self.pushButton.clicked.connect(self.on_pushButton_clicked)
self.pushButton_2.clicked.connect(self.on_pushButton_clicked_2)
self.pushButton_6.clicked.connect(self.on_pushButton_clicked_6)
and the error am getting is
Traceback (most recent call last):
File "C:/Users/pc/PycharmProjects/presents/Main.py", line 1, in <module>
from PyQt5 import QtCore, uic, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'
I find out that I can just use the available tool in PyCharm which is the IDE am using for python. By just clicking the red underlined word PyQt5 in this case and a red bulb will appear to the left end of the line >> click the drop down that appear and select install package PyQt5. it installs the required staff again and everything works fine then.
It sounds like the Python Console and your project are running two different Python Interpreters.
When you start the Python Console the top line should list the interpreter it's using. This is the one you installed PyQt5 to.
Go to: File -> Settings -> Project: xxxxx -> Project Interpreter and change it to the one that's in your Python Console. (Note you may need to add another interpreter by clicking on the gear to the right of the text box listing the interpreters)
Installing PyQt5 like this worked for me:
python -m pip install PyQt5
You can try to reinstall PyQt5 like this:
pip uninstall PyQt5
python -m pip install PyQt5

Python - PyQt5 [PyQt5.QtWidgets import QApplication 'No Module']

I have been attempting to learn PyQt5 in order to create GUI.
Pip installed the PyQt5 & the PyQt5.tools yet when I attempt to use it
using Visual Studio Code (while having the Python Extension of VS Code installed) I receive an error.
VS Code detects PyQt5 up to PyQt5.QtWidgets, yet it says no module inside QtWidgets named QApplication can be found.
Import Error of VS Code
On the contrary when it comes to the error, when I attempt to import QApplication from python.exe, no errors nor problems are presented.
Python.exe 'from PyQt5.QtWidgets import QApplication'
This leads me into thinking the problem resides at VS Code's doorstep..
Thanks for your time/answers.
open the cmd from start menu (Command Prompt)
type pip install pyqt5
type pip install pyqt5-stubs
install the integration of PyQt5 from VSCode Marketplace
if is it still not working try uninstalling PyQt5 (pip uninstall pyqt5)
and install it again
Search "PYQT Integration" on ur VS Code Extension shop
Install it
Set the configurations (ur pyqtdesigner path and pyuic etc)
this may help u
I had the same problem with lots of modules specially pytube . PyQt6 , It was all resolved when I changed my interpreter to python 3.11

advice about the PyQt5

Im working on application design using Qt Design. the design completed so now i want to connect it with Python 3.6.4 using pycharm. and import PyQt5. i already installed PyQt5 as you can see.
PS C:\Users\Tariq> pip install pyqt5
Requirement already satisfied :pyqt5 in
c:\users\tariq\appdata\local\programs\python\python36-32\lib\site-packages
Requirement already satisfied: sip<4.20,>=4.19.4 in
c:\users\tariq\appdata\local\programs\python\python36-32\lib\site-packages
(from pyqt5)
also i installed PyQt5 inside pycharm as you can see in the picture.
Press enter to show the image that PyQt5 installed inside pycharm
My Problem that the PyQt5 unknown for pycharm and this error appear
from PyQt5.QtWidgets import*
ModuleNotFoundError: No module named 'PyQt5
'
The way that has always worked for me is below.
from PyQt5 import QtCore, QtGui, QtWidgets
This maybe due to the way you set up your environment variable add this c:\Python3*\Script,C:\Python3*\Lib\site-packages\, and C:\Python34\Lib\site-packages\PyQt5\ in your environmental path, hope it works. '*` is the version of python e.g Python34

pyQt4 DLL load failed: The specified module could not be found

I have an issue using the pyQt4 library in Atom. I installed the package using the installation file from sourceforge. I have python 3.6 installed. This is the code I have now:
import sys
from PyQt4 import QtGui
Whenever I try to run this I get the following error:
File ".\test.py", line 4, in <module>
from PyQt4 import QtGui`
ImportError: DLL load failed: The specified module could not be found.
I already googled and found a few ways to fix this but none of the solutions worked for me. Here's what I have done so far:
-Confirmed all .dll files are in the main directory(no \bin directory)
-Confirmed both python and qt4 are 64bit.
-Created a an environment path in windows system pointing to qt4 directory
-Uninstalled and installed qt4 again
-Installed qt5 - got the same error.
-Confirmed python3.dll is present in python directory
Any idea what else might be the problem? Or perhaps I should just change to wxpython?
Thanks.
OK, I got it. I don't know why but I had to uninstall and re-install sip again.
I believe I installed pytq4 before installing sip and that didn't work well.
I uninstalled both pyqt4 and sip and installed sip -> pyqt4 in this order.
Hope this helps someone.

PyQt5 Maya 2017

Having some trouble setting up PyQt5 with Maya 2017. I have successfully installed PyQt5 on my mac and I can write standalone applications, but when I try to import PyQt5 modules in the Maya Script Editor using (for example)
from PyQt5 import QtWidgets
I get the following error :
Error: line 1: ImportError: file <maya console> line 1: No module named PyQt5
Not very experienced with using Python in Maya, is there some configuration I have to do? Also, does PyQt5 work with Maya 2016?
Maya won't ship with pyqt and you need to build your own version of pyqt for maya with mayapy. You local install of pyqt won't get loaded to maya so need to compile your version yourself. This link will give a insight of that http://justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/. Although maya 2017 shipping with PySide2 and you can always use Pyside rather than pyqt.
like
from PySide2 import QtWidgets
Hope this helps.
If you want your scripts and UIs to work on either Maya 2016 or 2017 and above, I would suggest using the Qt.py package from Marcus Ottoson.
You can find it here.
You can just install it somewhere on your computer and add its path to the 'path' variable in your environment variables, you can then just do:
from Qt import QtWidgets, QtCore, QtGui
You can then write your UIs as you would in PySide2, and they will work on all versions of Maya because Qt.py is just a wrapper choosing the proper binding available on your machine, whether it is Pyside, Pyside2, Qt5, Qt4.

Categories