Jul-08-2025, 02:42 PM
I am trying to install PyGObject into my virtual environment on a Fedora 42 system but it is failing during a missing dependency:
1. How can I get PyGObject installed?
2. Why is PIP trying to build Cairo? I have everything that is need to use PyGObject on the base system. Running this small code in the interpreter directly does work. Shouldn't it just pull a pre-built package? By having to build all of the dependencies for PyGObject, the system would have to have the full Gtk development environment, which just doesn't seem right.
Output:Collecting PyGObject (from -r ./virtualenv.txt (line 9))
Using cached pygobject-3.52.3.tar.gz (1.2 MB)
Installing build dependencies ... error
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [75 lines of output]
Collecting meson-python>=0.12.1
Using cached meson_python-0.18.0-py3-none-any.whl.metadata (2.8 kB)
Collecting pycairo>=1.16
Using cached pycairo-1.28.0.tar.gz (662 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'error'
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [48 lines of output]
+ meson setup /tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d /tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d/.mesonpy-xm0mp6_0 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dtests=false --native-file=/tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d/.mesonpy-xm0mp6_0/meson-python-native-file.ini
The Meson build system
Version: 1.8.2
Source dir: /tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d
Build dir: /tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d/.mesonpy-xm0mp6_0
Build type: native build
Project name: pycairo
Project version: 1.28.0
C compiler for the host machine: cc (gcc 15.1.1 "cc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)")
C linker for the host machine: cc ld.bfd 2.44-3
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/home/mitko/vortex/env/bin/python3)
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Warray-bounds: YES
Compiler for C supports arguments -Wcast-align: YES
Compiler for C supports arguments -Wconversion: YES
Compiler for C supports arguments -Wextra: YES
Compiler for C supports arguments -Wformat=2: YES
Compiler for C supports arguments -Wformat-nonliteral: YES
Compiler for C supports arguments -Wformat-security: YES
Compiler for C supports arguments -Wimplicit-function-declaration: YES
Compiler for C supports arguments -Winit-self: YES
Compiler for C supports arguments -Winline: YES
Compiler for C supports arguments -Wmissing-format-attribute: YES
Compiler for C supports arguments -Wmissing-noreturn: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wold-style-definition: YES
Compiler for C supports arguments -Wpacked: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wreturn-type: YES
Compiler for C supports arguments -Wshadow: YES
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wstrict-aliasing: YES
Compiler for C supports arguments -Wundef: YES
Compiler for C supports arguments -Wunused-but-set-variable: YES
Compiler for C supports arguments -Wswitch-default: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
Compiler for C supports arguments -Wno-unused-parameter: YES
Compiler for C supports arguments -fno-strict-aliasing: YES
Compiler for C supports arguments -fvisibility=hidden: YES
Found pkg-config: YES (/usr/bin/pkg-config) 2.3.0
Found CMake: /usr/bin/cmake (3.31.6)
Run-time dependency cairo found: NO (tried pkgconfig and cmake)
../cairo/meson.build:31:12: ERROR: Dependency "cairo" not found, tried pkgconfig and cmake
A full log can be found at /tmp/pip-install-tgctgvfn/pycairo_cb9c1f8bdd81416f8c68e9a26475394d/.mesonpy-xm0mp6_0/meson-logs/meson-log.txt
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 24.3.1 -> 25.1.1
[notice] To update, run: python3 -m pip install --upgrade pip
error: subprocess-exited-with-error
× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
make: *** [Makefile:62: venv] Error 1I have two questions:1. How can I get PyGObject installed?
2. Why is PIP trying to build Cairo? I have everything that is need to use PyGObject on the base system. Running this small code in the interpreter directly does work. Shouldn't it just pull a pre-built package? By having to build all of the dependencies for PyGObject, the system would have to have the full Gtk development environment, which just doesn't seem right.
>>> import gi
>>> gi.require_version("Gtk", "3.0")
... gi.require_version('GLib', '2.0')
... from gi.repository import Gtk, GLib, GObject, GdkPixbuf, Gdk
...
>>> w = Gtk.Window()
>>> w.show_all()
>>> Gtk.main()
