'pip install PyQt6 fails: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
Installing PyQt6 on a Linux Mint box fails with this error:
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
The same error is mentioned in several posts, sometimes for PyQt6, sometimes for other modules. However, none of the proposed solutions (like upgrading pip) seems to work.
Any suggestions on how to figure out what is wrong?
Below are the commands I used. Installation is in a virtual environment (but installing it on the main machine results in the same error).
johan@morla:~/work\> cat /etc/issue
Linux Mint 19 Tara \n \l
johan@morla:~/work\> python --version
Python 3.9.12
johan@morla:~/work\> python -m venv env
johan@morla:~/work\> . env/bin/activate
johan@morla:~/work\> pip list
Package Version
---------- -------
pip 22.1
setuptools 58.1.0
johan@morla:~/work\> pip install PyQt6
Collecting PyQt6
Using cached PyQt6-6.3.0-cp37-abi3-manylinux1_x86_64.whl (7.8 MB)
Collecting PyQt6-sip<14,>=13.2
Using cached PyQt6_sip-13.3.1-cp39-cp39-manylinux1_x86_64.whl (306 kB)
Collecting PyQt6
Using cached PyQt6-6.2.3-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.2-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.1-cp36-abi3-manylinux1_x86_64.whl (7.7 MB)
Using cached PyQt6-6.2.0.tar.gz (1.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Traceback (most recent call last):
File "/home/johan/work/env/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, 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'
Solution 1:[1]
Based on @eyllanesc's input: the problem is that PyQt6 depends on pyqt6-qt6, and the currently available wheels for pyqt6-qt6 require glibc version 2.28 or greater. As I am using Linux Mint 19 which has glibc 2.27, pip tries to build from source, which fails.
Hint: to check the glibc version, try ldd --version
Solution: upgrade Mint, or wait until @eyllanesc has a solution with an older glibc (or try to compile it myself).
Is there a way to get pip to give a clearer error message?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ygramoel |
