meshcore-uconsole icon indicating copy to clipboard operation
meshcore-uconsole copied to clipboard

Missing python dependencies for module named 'gi'

Open zomgugoff opened this issue 2 months ago • 3 comments

Trying to build commit fad29a0 on a Pi, getting an error about missing a library ('gi'). Installing PyGObject and dependencies is resulting in an error that 'gi' has no attribute 'require_version'.

Is version 3.58.0 of PyGObject (latest available via pip) not adequate for running this?

zomgugoff avatar Sep 10 '26 23:09 zomgugoff

Looking... I think this is just a local build issue that's fine in the deb package, trying on my uconsole

cwill747 avatar Sep 11 '26 13:09 cwill747

Investigated this against fad29a0.

The packaged .deb path should be correct: it depends on Debian's python3-gi plus the GTK4/Adwaita/Shumate typelibs, and the embedded venv is created with include-system-site-packages = true. The packaging workflow also installs the package on both Bookworm and Trixie before running meshcore-console --version.

gi.require_version() is a normal PyGObject API, so PyGObject 3.58.0 is not inherently incompatible. This error usually means the imported gi is not the real PyGObject module, or the venv cannot see the system package.

The likely manual-install pitfalls are:

  • Creating the venv without --system-site-packages.
  • Installing PyGObject from pip on Debian Bookworm. PyGObject 3.50+ requires GLib >= 2.80, while Bookworm ships GLib 2.74.6.
  • Installing a different/shadowing package named gi.

On the Pi, the expected setup is:

uv venv --python python3 --system-site-packages
uv sync
.venv/bin/python -c 'import gi; print(gi.__file__, gi.__version__, hasattr(gi, "require_version"))'

That should resolve gi from /usr/lib/python3/dist-packages/gi. Avoid pip install gi and avoid the optional PyGObject extra on Bookworm; use the distro package instead. Locally, the system PyGObject/GTK imports successfully and the test suite passes (175 passed, 1 skipped).

cwill747 avatar Sep 11 '26 13:09 cwill747

Ah. That would make sense. Removing gi/PyGObject/pycairo via pip took care of it.

zomgugoff avatar Sep 11 '26 22:09 zomgugoff