[solved] Trying to Snap Drawing


I was trying to snap Drawing (snapcraft.yaml here) after seeing the post on Omgubuntu.

Unfortunately a lot has changed in the Snapcraft world and I am having a little trouble figuring out things.

I am having the following error when running the snap:

$ eri0o-drawing.drawing 
Traceback (most recent call last):
  File "/snap/eri0o-drawing/x1/usr/bin/drawing", line 36, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'

But I am staging the python-gi package… This package builds with meson instead of having a setup.py.

I noticed the software also includes a deb builder script so maybe it should be used instead and in some way have that deb inside the snap, but I don’t know how to do it either.

(I tried to use a python part, but then I get ModuleNotFoundError: No module named 'distutils.util' right at start when it tries to install pip)

I did found someone on the forums with problems that I am not sure are relevant: Importing PIL and gi into a Snap , unfortunately, no working snapcraft.yaml file.

My system details:

$ lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic
$ uname -a
Linux 4.15.0-55-generic #60-Ubuntu SMP 
  Tue Jul 2 18:22:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ snapcraft --version
snapcraft, version 3.7.1

FYI @kenvandine and @alexmurray have also worked on this. They are almost done, so you might want to hold off this one so as not to duplicate work.


Ah, ok, I really just wanted to use the software, so I will wait :slight_smile:

1 Like

@ericoporto2008 I also encountered the same issues but couldn’t solve them either (although I didn’t spend a lot of time trying) - so is good to have @kenvandine on the case - I am leaving it to the expert so will be intriuged to find out how he ends up solving it :smile: The big issue I had was it uses Gtk.Template which is only in newer versions of PyGObject (so the version in python3-gi in bionic is not new enough so just a stage-packages of it is not enough) - this likely needs to be built from source explicitly as a separate part.

1 Like

Ah, damn, good information. For some reason pip directly instead of the Python packages from the Ubuntu repo gave me errors when using snapcraft (the distutils error above).

About the staging, when I mounted the snap by either installing or as it’s indicated here I do SEE the Python modules there, so it’s some environment thing the reason Python is failing, like it’s using the Python from machine directly or the Python in the snap has the wrong env.

Could you share your snapcraft.yaml even if didn’t worked out?

Hopefully @kenvandine will figure out.

You can find my attempt at https://github.com/alexmurray/drawing-snap - I didn’t end up committing the bits where I experimented with the python plugin to define an extra part for a newer PyGObject so it doesn’t actually work at all as is (well it builds but fails to launch with the same ModuleNotFoundError: No module named 'gi' error as you got - AND if you try launch it directly via /snap/drawing/current/usr/bin/drawing it gets further but fails since python3-gi is not new enough so Gtk.Template doesn’t exist).

1 Like

Thank you :slight_smile: it’s unfortunate we couldn’t do it. Let’s wait until someone figures this :smile:

This needs enough stuff that’s newer than what’s in bionic that it’s turned into a great test case for the new gnome-3-32-1804 build and content snaps. We found a couple things that we needed to add to the build snap then I’ll be able to finish this snap. Stay tuned!


It’s been uploaded to the store pending manual review


Awesome :slight_smile:

May be interesting to open an issue and let the developer know about it on the GitHub repo and also point to the snapcraft.yaml location for him :wink:

Edit: there’s something really wrong with the store page.

I’ll submit a PR upstream, but not until all the various pieces are in place. Right now you need to manually install the new gnome-3-32-1804 content snap and connect it’s interfaces. That snap should make it to stable in the next couple of weeks.

The store page is a mess, that’s imported from the appstream data in the project. @sergiusens is that a snapcraft bug? For reference the appstream data comes from https://github.com/maoschanz/drawing/blob/master/data/com.github.maoschanz.drawing.appdata.xml.in

I also noticed it was amd64 only, this means this not being automated through auto-build , which usually enables other archs.

I’ve filed a snapcraft bug about the appstream data and the store page https://bugs.launchpad.net/snapcraft/+bug/1839197

1 Like

The PR for that is here: https://github.com/snapcore/snapcraft/pull/2656

If anyone is xml transformations saavy, I would welcome a more complete template being proposed to generate these :slight_smile:

1 Like

Everything is fixed and working now, right?

Yes and no. The snap is fine, but it uses the gnome-3-32-1804 runtime which has not be published to stable yet. Therefore it won’t be installed and connected automatically. Once we get that published to stable I’ll publish drawing to stable.

Now that gnome-3-32-1804 is published to stable, I’ve released the drawing snap to stable. Enjoy!



I’ve installed - but the snap crashes - when running I see the following message:

snap run drawing
Gtk-Message: 22:16:19.039: Failed to load module "canberra-gtk-module"

(com.github.maoschanz.drawing:10525): Gtk-WARNING **: 22:16:19.247: Attempting to add a widget with type GtkFlowBox to a container of type GtkBox, but the widget is already inside a container of type GtkBox, please remove the widget from its existing container first.
activation du panneau …
… panneau activé
free(): invalid pointer
Aborted (core dumped)

snap list drawing
Name     Version        Rev  Tracking  Publisher    Notes
drawing  0+git.33155c2  9    stable    ken-vandine  -

Kind of odd - I’m using english GB locale - Ubuntu Budgie 18.04

Thank you so much! Another ppa I can remove <3

@kenvandine Where is the source of this snap? I’d like to see how you got all the fancy metadata in Ubuntu Software.