In my case old Mac (on Intel platform) with Brew, this issue happened during upgrade imagemagick, which depends on glib and harfbuzz. The error was:
meson.build:184:50: ERROR: Python dependency not found
I've checked brew configuration
brew --config
And observe, that Xcode component missing.
Xcode: N/A
Installation Xcode from App Store solves this issue.