Warpinator snap not working. When trying to run the snap fails with error message, "ModuleNotFoundError: No module named 'gi'"

I actually have a working warpinator snap but it’s published in the edge channel and unlisted because it’s not fully functional yet. It is possible to send files back and forth, but there’s some other issues I’m working on.

Screenshot%20from%202020-10-08%2013-48-03

Screenshot%20from%202020-10-08%2013-47-34

Oh…thank you @popey. Some good news at last. Would you please share your yaml file so I can compare and build locally? I want to learn.

Here’s what I’m currently using. It just consumes the pre-built deb directly out of the mint archives. This isn’t ideal. I did try building from source in the past, on 18.04, but there were a bunch of newer python packages needed. I moved to 20.04, but it was just as painful. So I switched to this method.

name: warpinator
base: core20
version: '1.0.8'
summary: Share files across the LAN
description: Allows simple local network file sharing.

grade: stable
confinement: strict

slots:
  # for GtkApplication registration
  snap-store:
    interface: dbus
    bus: session
    name: org.x.Warpinator

parts:
  desktop-gtk3:
    build-packages:
    - build-essential
    - libgtk-3-dev
    make-parameters:
    - FLAVOR=gtk3
    plugin: make
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: gtk
    stage-packages:
    - libxkbcommon0
    - ttf-ubuntu-font-family
    - dmz-cursor-theme
    - light-themes
    - adwaita-icon-theme
    - gnome-themes-standard
    - shared-mime-info
    - libgtk-3-0
    - libgdk-pixbuf2.0-0
    - libglib2.0-bin
    - libgtk-3-bin
    - unity-gtk3-module
    - libappindicator3-1
    - locales-all
    - xdg-user-dirs
    - ibus-gtk3
    - libibus-1.0-5
    - fcitx-frontend-gtk3
  warpinator: 
    source: http://packages.linuxmint.com/pool/backport/w/warpinator/warpinator_$SNAPCRAFT_PROJECT_VERSION+ulyana_all.deb
    plugin: dump
    stage-packages:
      - libc-ares2 
      - python3-pip
      - python3
      - python3-cryptography
      - python3-zeroconf
      - python3-xapp
      - python3-setproctitle
      - python3-netifaces
      #- libglu1-mesa
      - python3-nacl
      - python3-grpcio
      - gir1.2-xapp-1.0
      - python3-gi
      - gobject-introspection
      - gir1.2-gtk-3.0
      - gir1.2-glib-2.0
      - python3-protobuf
      - python3-packaging
    override-pull: |
      snapcraftctl pull
      sed -i 's|/usr/libexec|/snap/warpinator/current/usr/libexec|' usr/bin/warpinator
    override-build: |
      snapcraftctl build
      echo "#!/bin/sh" > $SNAPCRAFT_PART_INSTALL/warpinator
      #echo "/snap/warpinator/current/usr/bin/python3 /snap/warpinator/current/usr/libexec/warpinator/warpinator.py" >> $SNAPCRAFT_PART_INSTALL/warpinator
      echo "/usr/bin/python3 /snap/warpinator/current/usr/libexec/warpinator/warpinator.py" >> $SNAPCRAFT_PART_INSTALL/warpinator
      chmod +x $SNAPCRAFT_PART_INSTALL/warpinator
      sed -i 's|config.pkgdatadir|"/snap/warpinator/current/usr/share/warpinator"|g' $SNAPCRAFT_PART_INSTALL/usr/libexec/warpinator/warpinator.py
      sed -i 's|config.pkgdatadir|"/snap/warpinator/current/usr/share/warpinator"|g' $SNAPCRAFT_PART_INSTALL/usr/libexec/warpinator/prefs.py

apps:
  warpinator:
    command-chain: [bin/desktop-launch]
    command: warpinator
    environment:
      LD_LIBRARY_PATH: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pulseaudio:$LD_LIBRARY_PATH"
      DISABLE_WAYLAND: 1
      XDG_CURRENT_DESKTOP: Unity
      TMPDIR: $XDG_RUNTIME_DIR
      XDG_DATA_HOME: $SNAP_USER_COMMON
      HOME: $SNAP_USER_COMMON
      GSETTINGS_SCHEMA_DIR: $SNAP/usr/share/glib-2.0/schemas
      PYTHONPATH: $SNAP/usr/lib/python3/dist-packages
      GI_TYPELIB_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/girepository-1.0
    plugs:
      - avahi-control
      - audio-playback
      - x11
      - opengl
      - desktop
      - desktop-legacy
      - network
      - network-bind
      - unity7
      - wayland
      - gsettings
      - home
      - removable-media
1 Like

Thank you @popey. I did install your warpinator snap from beta channel and looked at snap.yaml. I saw you used core20 but when I tried it with extensions method, it said that extension gnome-3-34 is not supported yet, so I went with desktop-helpers method. Since snap.yml did not have ‘parts’, I combined the ‘environment’, ‘command-chain’ from your file and ‘parts’ from my file. Still doesn’t work (while your snap works). Will use your snapcraft.yaml file to locally build and check.

BTW, there is a interesting discussion regarding python plugin, which may help me. Will check that as well.