uv add toga or uv add toga-demo on MacOS fails. It tries to build pygobject (which is a linux thing) and fails. Interestingly uv pip install toga works correctly.
Steps to reproduce
Create a new directory
Issue the commands
uv init --python 3.12
uv sync
uv add toga
See failure error
Notice uv tries to download and build pygobject which is GTK for linux, and should not be happening on a Mac!
% uv add toga
× Failed to download and build `pygobject==3.50.0`
╰─▶ Build backend failed to build wheel through `build_wheel` (exit status: 1)
...
help: `pygobject` (v3.50.0) was included because `py-15-toga-py12` (v0.1.0) depends on `toga` (v0.4.8) which depends
on `toga-gtk==0.4.8` (v0.4.8) which depends on `pygobject>=3.50.0`
Expected behavior
Expect successful installation of toga wheel without needing pygobject .
Screenshots
No response
Environment
Operating System: MacOS 15.1.1
Python version: 3.12
Software versions:
Toga: latest
Logs
% uv add toga
× Failed to download and build `pygobject==3.50.0`
╰─▶ Build backend failed to build wheel through `build_wheel` (exit status: 1)
[stdout]
+ meson setup /Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src
/Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src/.mesonpy-qhu3xuzk
-Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dtests=false -Dwheel=true --wrap-mode=nofallback
--native-file=/Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src/.mesonpy-qhu3xuzk/meson-python-native-file.ini
The Meson build system
Version: 1.6.0
Source dir: /Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src
Build dir: /Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src/.mesonpy-qhu3xuzk
Build type: native build
Project name: pygobject
Project version: 3.50.0
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.4)")
C linker for the host machine: cc ld64 1115.7.3
Host machine cpu family: aarch64
Host machine cpu: aarch64
Program python3 found: YES (/Users/andy/.cache/uv/builds-v0/.tmphEIS5m/bin/python)
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.3.0
Run-time dependency python found: YES 3.12
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency gobject-introspection-1.0 found: NO (tried pkgconfig, framework and cmake)
Not looking for a fallback subproject for the dependency gobject-introspection-1.0 because:
Use of fallback dependencies is disabled.
../meson.build:31:9: ERROR: Dependency 'gobject-introspection-1.0' is required but not found.
A full log can be found at
/Users/andy/.cache/uv/sdists-v6/pypi/pygobject/3.50.0/cSgYGol3pHG6adtW916RT/src/.mesonpy-qhu3xuzk/meson-logs/meson-log.txt
help: `pygobject` (v3.50.0) was included because `py-15-toga-py12` (v0.1.0) depends on `toga` (v0.4.8) which depends
on `toga-gtk==0.4.8` (v0.4.8) which depends on `pygobject>=3.50.0`
Additional context
Workarounds:
brew install pygobject3 before uv add toga solves the dependency and allows uv add toga to succeed. However this should not be needed on a Mac, as GTK is not relevant on Mac.
Alternatively, a different way of installing toga via uv pip install toga works. This avoids the workspace level uv add toga approach.
Describe the bug
uv add toga
oruv add toga-demo
on MacOS fails. It tries to buildpygobject
(which is a linux thing) and fails. Interestinglyuv pip install toga
works correctly.Steps to reproduce
pygobject
which is GTK for linux, and should not be happening on a Mac!Expected behavior
Expect successful installation of toga wheel without needing
pygobject
.Screenshots
No response
Environment
Logs
Additional context
Workarounds:
brew install pygobject3
beforeuv add toga
solves the dependency and allowsuv add toga
to succeed. However this should not be needed on a Mac, as GTK is not relevant on Mac.uv pip install toga
works. This avoids the workspace leveluv add toga
approach.May be related to https://github.com/astral-sh/uv/issues/7985