Python Forum
pip fails to install PyGObject
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pip fails to install PyGObject
#1
I am trying to install PyGObject into my virtual environment on a Fedora 42 system but it is failing during a missing dependency:

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 1
I 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()
Reply
#2
Quote: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.

It is, because you have created an isolated environment, it is totally separate to the main system!

Actually, main packages I dunno, but try: pip install pycairo
Reply
#3
pip is not native to fedora, so may (or may not) run into problems.
Have you tried: https://developer.fedoraproject.org/tech...bject.html ?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to install the edk2-rk3399 code but the script fails due some python bug mariozio 2 1,919 Aug-17-2025, 10:25 PM
Last Post: mariozio
  Could not install PyGObject Srikant 4 15,623 Nov-02-2020, 11:43 AM
Last Post: snippsat
  pip3 install opencv-python fails on 'skbuild' Pedroski55 2 10,421 Sep-15-2020, 11:33 AM
Last Post: snippsat
  Install Fails v3.8.3 flyboy91901 0 2,428 Jun-26-2020, 05:31 PM
Last Post: flyboy91901
  Install of Pillow fails RMJFlack 4 15,489 Jan-28-2019, 12:31 PM
Last Post: snippsat
  fail to upgrade pygobject jiapei100 0 4,254 Aug-16-2018, 10:32 AM
Last Post: jiapei100

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020