Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`pyqt5' error `metadata-generation-failed`

I am trying to install pyqt5 using mac OS with the M1 chip and Python 3.9.12. I suspect the M1 chip may be the cause.

I get an error metadata-generation-failed.

minimum working example

# directly in the terminal
pip install --no-cache-dir PyQt5==5.14.1

or by adding the line below to a requirements.txt

# necessary for jupyter-notebook so added to requirements.txt
# then run: pip install -r requirements.txt
pyqt5==5.14.1 # missing in conda-forge

my attempts

I also tried using the solutions below but non worked. Homebrew also claimed that pyqt was installed which was strange.

  1. pip install pyqt5
  2. brew install pyqt5
  3. adding it to requirements.txt then running pip install -r requirements.txt

related questions:

  • AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel' for PyQt5 5.15.0
like image 653
user4933 Avatar asked Jul 03 '26 18:07

user4933


1 Answers

This might really be a M1 issue. I think this is a similar issue to yours: How can i run pyqt5 on my mac with M1chip

But it might be a better solution to just build the PyQt5 package from source: Building PyQt5 from Source

I also found this script where someone builds and installs PyQt6 on a M1 Mac: Build PyQt6 on M1. This script can be altered to build PyQt5.

EDIT: Consider using PyQt6 (pip install PyQt6). It already has a universal2 build on pypi.

like image 158
wambo Avatar answered Jul 06 '26 06:07

wambo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!