Python Forum
So lost - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: So lost (/thread-12993.html)

Pages: 1 2


So lost - mtndewwarrior - Sep-23-2018

I have no idea how to install pyqt 4 everything i find online doesnt help because what it tells me to do doesnt work. i dont know where im supposed to put the sip files or the pyqt4 files.....

they say goto cmd and type in python configure-ng.py well it tells me its not in directories

if i run the configure-ng.py from the files i downloaded it says qmake files not in directory. so i try to do what they say to make it find qmake files and use --qmake or --q and it still doesnt work

if i run the file configure in the pyqt4 files it says i need a sip version 4.19.12 installed, and that is the version i installed...


RE: So lost - Larz60+ - Sep-23-2018

pip install pyqt4
above will automatically install for the python in path,
if using python3, to make sure, use:
pip3 install pyqt4
do this from command line. pyqt5 is latest, and what you should use.


RE: So lost - mtndewwarrior - Sep-23-2018

I will try pyqt5. I was just watching a intro tutorial to gui and that's what he used. Could have been before pyqt5. I did try to do that at first with pyqt and it wouldnt install. However I didn't know anything about pipe could have been the problem

C:\Users\mjona>pip3 install pyqt5
Requirement already satisfied: pyqt5 in c:\users\mjona\appdata\local\programs\python\python37-32\lib\site-packages (5.11.2)
Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in c:\users\mjona\appdata\local\programs\python\python37-32\lib\site-packages (from pyqt5) (4.19.12)



say there is no module for pywt5


RE: So lost - Axel_Erfurt - Sep-23-2018

do

Quote:pip3 show pyqt5

my output is

Output:
Name: PyQt5 Version: 5.11.2 Summary: Python bindings for the Qt cross platform UI and application toolkit Home-page: https://www.riverbankcomputing.com/software/pyqt/ Author: Riverbank Computing Limited Author-email: [email protected] License: GPL v3 Location: /home/brian/.local/lib/python3.6/site-packages Requires: PyQt5-sip Required-by:
if your output is not empty try an example

from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)

class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Test")
        self.setGeometry(50, 50, 250, 150)


    def msgbox(self, message):
        QMessageBox.information(self, "Message", message)


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()
    mainWin.msgbox("it works")
    sys.exit(app.exec_())



RE: So lost - mtndewwarrior - Sep-23-2018

I ran pip3 show pyqt5 and pyqt5-sip and got the same results as you.


This is the error it gives me with your exact code.

Traceback (most recent call last):
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 1, in <module>
from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)
ModuleNotFoundError: No module named 'PyQt5'

Process finished with exit code 1


RE: So lost - Axel_Erfurt - Sep-23-2018

Did you run gui test.py with python 3 ?


RE: So lost - mtndewwarrior - Sep-23-2018

import sys

print(sys.version)

from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)


class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setWindowTitle("Test")
        self.setGeometry(50, 50, 250, 150)

    def msgbox(self, message):
        QMessageBox.information(self, "Message", message)


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    mainWin = MainWindow()
    mainWin.show()
    mainWin.msgbox("it works")
    sys.exit(app.exec_())
I have it printing the python version. as far as i can tell i am using python 3


C:\Users\mjona\PycharmProjects\untitled\venv\Scripts\python.exe "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py"
Traceback (most recent call last):
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)]
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 5, in <module>
from PyQt5.QtWidgets import (QApplication, QMainWindow, QMessageBox)
ModuleNotFoundError: No module named 'PyQt5'

Process finished with exit code 1

PyQt5 is probably installed into site-packages and not dist-packages.

You must verify your PYTHONPATH, and add site-package if needed.

export PYTHONPATH=$PYTHONPATH:/usr/lib/python3.2/site-packages (adapt
the path)


this is the only thing i have found that could actually be my problem, but i have tried what is says to do, and i cant figure it out. i copied the code, and put the location of site packages on my pc....


RE: So lost - Axel_Erfurt - Sep-23-2018

If you use venv, then you must install pyqt5 in it.


RE: So lost - mtndewwarrior - Sep-23-2018

i copied everything from site packages to a folder in site-packages, and put it in a folder named PyQt5 in Lib.

no this is the error


Traceback (most recent call last):
File "C:/Users/mjona/PycharmProjects/untitled/test projects/gui test.py", line 3, in <module>
from PyQt5.QtGui import QPalette, QKeySequence, QIcon
ModuleNotFoundError: No module named 'PyQt5.QtGui'

Process finished with exit code 1

(Sep-23-2018, 04:00 PM)Axel_Erfurt Wrote: If you use venv, then you must install pyqt5 in it.

I uninstalled pyqt5 and pyqt5-sip it still sisnt work. so i moved all the files in site packages to Lib and it works. thanks for all the help.


RE: So lost - Axel_Erfurt - Sep-23-2018

you should install it in venv with pip.

https://packaging.python.org/guides/installing-using-pip-and-virtualenv/