Python Forum
ui to py command error
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ui to py command error
#1
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
Reply
#2
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
Reply
#3
How did you install pyqt? Was it through pip?
Reply
#4
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
Reply
#5
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 !
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGUI] Invalid command error with Entry object eliqm 8 2,027 May-18-2023, 10:14 PM
Last Post: eliqm

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020