Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PyQt5 is not recognized from python 3.8 installation in python 3.10

2,832 views
Skip to first unread message

Mohsen Owzar

unread,
Aug 22, 2021, 9:04:53 AM8/22/21
to
Hi guys,
I have on my laptop the python installation 3.8 and newly I installed newest version 3.10 as well on my laptop.
Now I have two IDLEs for both of the installations.
When I rund some *.py file, having PyQt5 module, on the 3.8 version, it works as before without any problems.
But whenn I run the same file on IDLE with 3.10 installation, it crashes and says that PyQt5 is not known.

I tried to install this package with"pip install pyqt5" or with "py -3 -m pip install pyqt5", it brings lots of error messages (long long) as the lines below (they are only the beginning of the messages):
==================================================
C:\Users\Mohsen>py -3 -m pip install pyqt5
Collecting pyqt5
Using cached PyQt5-5.15.4.tar.gz (3.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Mohsen\AppData\Local\Temp\tmprax0esmt'
cwd: C:\Users\Mohsen\AppData\Local\Temp\pip-install-wl_b58e9\pyqt5_1cbd1bab46fa4abaad34b55514561ce6
Complete output (33 lines):
Querying qmake about your Qt installation...
C:\Qt\4.7.4\bin\qmake.exe -query
Traceback (most recent call last):
File "C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 143, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 349, in <module>
main()
File "C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 331, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
==============================================
It begins with "PyQt5-5.15.4.tar.gz" and goes down "PyQt5-5.15.3.tar.gz" and so on, after it cannot install that version.
After it reaches the "PyQt5-5.14.0.tar.gz" it breaks the downloading and bring this message
==============================================
WARNING: Discarding https://files.pythonhosted.org/packages/3a/fb/eb51731f2dc7c22d8e1a63ba88fb702727b324c6352183a32f27f73b8116/PyQt5-5.14.1.tar.gz#sha256=2f230f2dbd767099de7a0cb915abdf0cbc3256a0b5bb910eb09b99117db7a65b (from https://pypi.org/simple/pyqt5/) (requires-python:>=3.5). Command errored out with exit status 1: 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Mohsen\AppData\Local\Temp\tmp6t_i9jm7' Check the logs for full command output.
Downloading PyQt5-5.14.0.tar.gz (3.2 MB)
|████████████████████████████████| 3.2 MB 3.3 MB/s
ERROR: pyqt5 from https://files.pythonhosted.org/packages/7c/5b/e760ec4f868cb77cee45b4554bf15d3fe6972176e89c4e3faac941213694/PyQt5-5.14.0.tar.gz#sha256=0145a6b7de15756366decb736c349a0cb510d706c83fda5b8cd9e0557bc1da72 has a pyproject.toml file that does not comply with PEP 518: 'build-system.requires' contains an invalid requirement: 'sip >=5.0.1 <6'
==============================================

What is wrong with my installations.
How can I get all the packages available in 3.8 version also available for 3.10 version without any new installation in 3.10 for each all already existing packages?

Thanks a lot in advance for you contributions.
Mohsen

Chris Angelico

unread,
Aug 22, 2021, 3:28:32 PM8/22/21
to
On Mon, Aug 23, 2021 at 4:31 AM Mohsen Owzar <mohsen...@gmail.com> wrote:
> How can I get all the packages available in 3.8 version also available for 3.10 version without any new installation in 3.10 for each all already existing packages?
>

You can't. With compiled binaries, especially, it's important to
install into each version separately - there can be minor differences
which will be taken care of by the installer. Normally, that's not a
problem, other than that you have to install each one again; the best
way would be to keep track of your package dependencies in a file
called requirements.txt, and then you can simply install from that
(python3 -m pip install -r requirements.txt) into the new version.

As to PyQt5 specifically, though.... I don't know what the issue here
is, but I tried it on my system and it successfully installed version
5.15.4. Are you using the latest version of pip? There might be some
other requirements. Alternatively, I'm seeing a potential red flag
from this line:

> C:\Qt\4.7.4\bin\qmake.exe -query

You're trying to install Qt5, but maybe it's coming across a Qt4
installation? Not sure if that's significant or not.

ChrisA

Mats Wichmann

unread,
Aug 22, 2021, 6:58:07 PM8/22/21
to
On 8/22/21 7:04 AM, Mohsen Owzar wrote:
> Hi guys,
> I have on my laptop the python installation 3.8 and newly I installed newest version 3.10 as well on my laptop.
> Now I have two IDLEs for both of the installations.
> When I rund some *.py file, having PyQt5 module, on the 3.8 version, it works as before without any problems.
> But whenn I run the same file on IDLE with 3.10 installation, it crashes and says that PyQt5 is not known.
>
> I tried to install this package with"pip install pyqt5" or with "py -3 -m pip install pyqt5", it brings lots of error messages (long long) as the lines below (they are only the beginning of the messages):

make sure you're getting the right Python by doing

py -3.10 -m pip install pyqt5

(the fact you're getting the build error below indicates you _are_
getting the right one, but it's good to be explicit anyway, just so
you're sure).

> ==================================================
> C:\Users\Mohsen>py -3 -m pip install pyqt5
> Collecting pyqt5
> Using cached PyQt5-5.15.4.tar.gz (3.3 MB)
> Installing build dependencies ... done
> Getting requirements to build wheel ... done
> Preparing wheel metadata ... error
> ERROR: Command errored out with exit status 1:
> command: 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Mohsen\AppData\Local\Temp\tmprax0esmt'
> cwd: C:\Users\Mohsen\AppData\Local\Temp\pip-install-wl_b58e9\pyqt5_1cbd1bab46fa4abaad34b55514561ce6
> Complete output (33 lines):
> Querying qmake about your Qt installation...
> C:\Qt\4.7.4\bin\qmake.exe -query
> Traceback (most recent call last):
> File "C:\Users\Mohsen\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 143, in prepare_metadata_for_build_wheel
> hook = backend.prepare_metadata_for_build_wheel
> AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

Your problem here is that there's no released binary wheel for PyQt5,
since Py 3.10 isn't released (there's been some recent chatter about
encouraging projects to make builds for new Python versions available
early, e.g. once a Python version hits release candidate state, but
that's just that - chatter - for now).

In theory your system should be able to build it, but my experience is
that unless you're an active Python developer on Windows and already
have the right working setup, it pretty much always fails. These are
the perils of trying to use a pre-release...

That error suggests there's something different going on than usual
(which has to do with the MSVC compiler suite not being set up the way
the package expects): there looks like a version mismatch - it looks
like it's finding qmake for Qt4, not Qt5. Maybe you can make some
progress by adjusting some paths?

Many people go here to get early-access, albeit unofficial, binary wheels:

https://www.lfd.uci.edu/~gohlke/pythonlibs

Unfortunately, PyQt5 is not available from there (as listed in the
section at the very bottom)


Barry

unread,
Aug 23, 2021, 6:25:38 PM8/23/21
to


> On 23 Aug 2021, at 00:00, Mats Wichmann <ma...@wichmann.us> wrote:
Only trivial C code extensions can be built on windows.
And then only if you have the right MSVC tools installed.
Most interesting extensions have dependencies only other software.
Which means that you need to know how to build all the dependencies as well.

For something as complex as PyQt5 you need to be a developer with reasonable experience to build it.

Check on PyPI for the available versions and install one of them.

Barry



>
> Many people go here to get early-access, albeit unofficial, binary wheels:
>
> https://www.lfd.uci.edu/~gohlke/pythonlibs
>
> Unfortunately, PyQt5 is not available from there (as listed in the section at the very bottom)
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Mohsen Owzar

unread,
Aug 24, 2021, 1:06:54 AM8/24/21
to
Thanks a lot for your answers.
That's true. I had a project which used Qt4.7, and I have still on my laptop.
I have not so big knowledge about compiling and building stuff, so I have to get rid of 3.10 version.
OK, then I try to remove Python 3.10 and to install 3.9.6.
Best regards
Mohsen
0 new messages