Python Forum
ui to py command error - 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: ui to py command error (/thread-9465.html)



ui to py command error - Diovanno - Apr-10-2018

Hi All,

I installed PyQt5 on my laptop and trying to convert my .ui file into .py using the command prompt and get the following errors when trying different commands:

1) C:\Python35\Lib\site-packages\PyQt5>pyuic5.bat -x FirstApp.ui -o FirstApp.py
'"C:\Python35\python"' is not recognized as an internal or external command,
operable program or batch file.

2) C:\Python35\Lib\site-packages\PyQt5>pyuic5 FirstApp.ui -o FirstApp.py
'"C:\Python35\python"' is not recognized as an internal or external command,
operable program or batch file.

3) C:\Python35\Lib\site-packages\PyQt5>pyuic4 FirstApp.ui -o FirstApp.py
'pyuic4' is not recognized as an internal or external command,
operable program or batch file.

Steps i followed on the internet include:

1) Reinstalled PyQt5
2) Made sure that the Python location on local C:/ in included in my Environmental Variables in system Settings
3) made sure that the pyuic5.bat file is located in my Python directory.

I'm not sure what else to do or try and been looking to find a solution for this. any help or advice will be gladly appreciated.

Note: I have Python 3.6 installed and PyQt5

Regards

Diovanno


RE: ui to py command error - Diovanno - Apr-11-2018

Hi Guys,

I tried the following to help resolve my issue. I edited my pyuic5.bat file located in C:\Python35\Lib\Site-Packages\PyQt5 as follows:

Original Script:
Quote:@"C:\Python35\python" -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9

My Edit: to point my bat file to where my Python directory is
Quote:@"C:\Program Files\Python36\python.exe" -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9

Then when i try running the convert command again i get a new error:

Quote:C:\Program Files\Python36\python.exe: Error while finding module specification for 'PyQt5.uic.pyuic' (ModuleNotFoundError: No module named 'PyQt5')

I'm not what sure to do next to get around this very frustrating error. any help will be gladly appreciated.

Regards

Diovanno


RE: ui to py command error - nilamo - Apr-11-2018

How did you install pyqt? Was it through pip?


RE: ui to py command error - Diovanno - Apr-11-2018

Hi nilamo.

No i downloaded the exe file from the website PyQt5-5.6-gpl-Py3.5-Qt5.6.0-x32-2.exe and installed all features and added ticked 'Add PATH" in below options.

regards

Hi All,

I managed to fix the error. I re-installed Python directly to the C:\Python36 location, edited my pyuic5.bat file so that it has the new location. I also used CMD and installed the latest PyQt5.10 via the pip command like nilamo mentioned. Results below:

Quote:C:\Python36\Scripts>pip install pyqt5
Collecting pyqt5
Downloading PyQt5-5.10.1-5.10.1-cp35.cp36.cp37.cp38-none-win_amd64.whl (81.0MB)
100% |████████████████████████████████| 81.0MB 7.7kB/s
Collecting sip<4.20,>=4.19.4 (from pyqt5)
Downloading sip-4.19.8-cp36-none-win_amd64.whl (51kB)
100% |████████████████████████████████| 51kB 1.1MB/s
Installing collected packages: sip, pyqt5
Successfully installed pyqt5-5.10.1 sip-4.19.8

After this i was able to convert my .ui files.

Thanks all for the help, especially nilamo for hinting me in the right direction.

Regards

Diovanno


RE: ui to py command error - zorekk - Aug-26-2020

Diovanno

Thank you for this post !!

I have looking for answer on many Forums...
And All Experts reply same answer but resolve was completly different.
YOUR Way is only correct way to resolve it, install pyqt5 by pip in python.

Most user in Forums use linux or Mac, and have No idea for Windows Complications and problems..
Most problem in Windows are with Path or exe files. But this is no Reason for Go Only in Linux and think simple. As most users still on Windows.

For Problem
'pyuic5' is not recognized as an internal or external command,
operable program or batch file.

Solution is:
pip install pyqt5

or in Future for other QT version, just check which one you have installed.

CONFIRMED.
Installing collected packages: PyQt5-sip, pyqt5
Successfully installed PyQt5-sip-12.8.0 pyqt5-5.15.0

THANKS !