Installing PyQt5 on `arm64` stopped working all of a sudden (some `sip` issue)

Hey everyone, I have an Python script that uses PyQt5. Unfortunately there is no wheel for pyqt5 to install it with pip so you have to build from source, if you are on arm64. This is how I successfully did it till today:

  1. It requires qmake, which I installed via brew (brew install qt5). After adding this to my path I can execute it (which qmake shows the correct path).

  2. Then I install pyqt5 via pip with this command: pip install pyqt5 --config-settings --confirm-license= --verbose (pyqt5 asks for license agreement, but pip install is not interactive, hence the long command).

As I said, till last week I could do this successfully. When I tried this today I got the error:

  The dbus-python package does not seem to be installed.
  These bindings will be built: Qt, pylupdate, pyrcc.
  Generating the Qt bindings...
  Generating the pylupdate bindings...
  _in_process.py: /private/var/folders/ws/vdb_nvyj35g9ck_srpvqpccm0000gn/T/pip-install-jr3725ba/pyqt5_7d0f0bcc5a7241bd8afa726e0fa5e8d1/sip/QtCore/qprocess.sip: line 99: column 5: 'Q_PID' is undefined
  error: subprocess-exited-with-error

It seems thta something with sip-related changed. The only thing that has changed on my system was an update from Xcode14 to Xcode15. I don't really see why this should affect pyqt5 or sip, but it's the only thing I can think of.

I also tried to install sip via brew additionally, but this did not change anything.

Any ideas?

Answered by gernophil in 765824022

I can confirm that the reason it did not work anymore (macOS, arm64), was due to Xcode 15. I downloaded Xcode 14.3.1 from here (https://download.developer.apple.com/Developer_Tools/Xcode_14.3.1/Xcode_14.3.1.xip), unzipped it, renamed Xcode.app to Xcode_14.3.1.app (to be able to have both versions in parallel), copied it to /Applications and started it. After that I set the command line tools to 14.3.1 (Settings -> Locations; there are also other ways like xcode-select -s and also ways with command line tools only) and just installed PyQt5 using this command: pip install pyqt5 --config-settings --confirm-license= --verbose. I can confirm that building PyQt5 from source works again (this still needs qmake from brew or from qt.io), so there is an incompatibility with some of the contents of Xcode 15. I'll try to find out, which one this is exactly.

Accepted Answer

I can confirm that the reason it did not work anymore (macOS, arm64), was due to Xcode 15. I downloaded Xcode 14.3.1 from here (https://download.developer.apple.com/Developer_Tools/Xcode_14.3.1/Xcode_14.3.1.xip), unzipped it, renamed Xcode.app to Xcode_14.3.1.app (to be able to have both versions in parallel), copied it to /Applications and started it. After that I set the command line tools to 14.3.1 (Settings -> Locations; there are also other ways like xcode-select -s and also ways with command line tools only) and just installed PyQt5 using this command: pip install pyqt5 --config-settings --confirm-license= --verbose. I can confirm that building PyQt5 from source works again (this still needs qmake from brew or from qt.io), so there is an incompatibility with some of the contents of Xcode 15. I'll try to find out, which one this is exactly.

Hello,

If it can help qmake from Qtcreator LTS 6.2.4 does not work with clang 15.0.. You probably have to use clang 13.0

Did anyone fix this issue. I have it on my Mac M1 Ultra with Sonoma and cannot use xcode14.

I am also running Sonoma (though I configured it using Ventura). It might still work. Just download Xcode 14.3.1 (https://download.developer.apple.com/Developer_Tools/Xcode_14.3.1/Xcode_14.3.1.xip)

Unzip it, rename Xcode.app to Xcode_14.3.1.app and move it to /Applications. Execute sudo xcode-select -s /Applications/Xcode_14.3.1.app/Contents/Developer.

Not 100% sure, this will work, but it could.

Thank you for the post, It helped in get PyQt installed using sip

Installing PyQt5 on `arm64` stopped working all of a sudden (some `sip` issue)
 
 
Q