8

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:

user4933
  • 1,485
  • 3
  • 24
  • 42

2 Answers2

1

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.

wambo
  • 61
  • 5
0

For troubleshooting purposes, can you run :

# Make sure python3 points to your Python 3.9.12
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
pip install --no-cache-dir PyQt5==5.14.1
# If last step fails and complains about `pip` version, upgrade `pip` and try `pip install ..` again

If PyQt5 is installed successfully, then you are sure it's not a problem of M1 chip. Then you can try :

python3 -m pip install --no-cache-dir PyQt5==5.14.1
Philippe
  • 20,025
  • 2
  • 23
  • 32