I am running a raspberrypi 4B with bookworm (and whichever desktop - X11 or Wayland - that allows it to work with VNC) and writing code in Python. I am trying to read (and maybe eventually write) to other packages using either DBUS or MPRIS(2). I have created a virtual environment ("henry"):-
python -m venv henry
source henry/bin/activate
and then installed pydbus successfully:
pip3 install pydbus
I ran python3, and tried to import pydbus:-
>>> import pydbus
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hi-pi/Projects/NewElixir/henry/lib/python3.11/site-packages/pydbus/__init__.py", line 1, in <module>
from .bus import SystemBus, SessionBus, connect
File "/home/hi-pi/Projects/NewElixir/henry/lib/python3.11/site-packages/pydbus/bus.py", line 1, in <module>
from gi.repository import Gio
ModuleNotFoundError: No module named 'gi'
but I cannot find a way around this.
So I thought I would try to get around this by using MPRIS.
From https://github.com/alexdelorenzo/mpris_server, I followed the instructions, and ran:-
sudo apt install python3-gi
from within the environment, which installed OK, then ran the MPRIS server install:-
pip3 install mpris_server
which gave:-
pip3 install mpris_server
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mpris_server
Downloading https://www.piwheels.org/simple/mpris-server/mpris_server-0.8.1-py3-none-any.whl (26 kB)
Collecting emoji<3.0.0,>=2.8.0
Downloading https://www.piwheels.org/simple/emoji/emoji-2.14.1-py3-none-any.whl (590 kB)
â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â” 590.6/590.6 kB 3.7 MB/s eta 0:00:00
Requirement already satisfied: pydbus<0.7.0,>=0.6.0 in ./henry/lib/python3.11/site-packages (from mpris_server) (0.6.0)
Collecting PyGObject>=3.34.0
Using cached pygobject-3.52.3.tar.gz (1.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
+ meson setup /tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6 /tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6/.mesonpy-ghpu3dv6 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dtests=false -Dwheel=true --wrap-mode=nofallback --native-file=/tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6/.mesonpy-ghpu3dv6/meson-python-native-file.ini
The Meson build system
Version: 1.7.2
Source dir: /tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6
Build dir: /tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6/.mesonpy-ghpu3dv6
Build type: native build
Project name: pygobject
Project version: 3.52.3
C compiler for the host machine: cc (gcc 12.2.0 "cc (Debian 12.2.0-14) 12.2.0")
C linker for the host machine: cc ld.bfd 2.40
Host machine cpu family: aarch64
Host machine cpu: aarch64
Program python3 found: YES (/home/hi-pi/Projects/NewElixir/henry/bin/python)
Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1
Run-time dependency python found: YES 3.11
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency girepository-2.0 found: NO (tried pkgconfig and cmake)
Not looking for a fallback subproject for the dependency girepository-2.0 because:
Use of fallback dependencies is disabled.
../meson.build:31:9: ERROR: Dependency 'girepository-2.0' is required but not found.
A full log can be found at /tmp/pip-install-126x1pvb/pygobject_37e1b70466af4b5baa83735c77a946b6/.mesonpy-ghpu3dv6/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.
How do I proceed?