ModuleNotFoundError: No module named 'tkinter'

Thanks @argosopentech for the repo!

I am actually trying to display the tkinter windows snap on a mir-X11-kiosk server so that it can be used in ubuntu core 18.

I have changed my snapcraft.yaml file according to the mir-x11-kiosk server template as follows:

name: x11-tkinter-demo     # YOUR SNAP NAME GOES HERE
version: '0.1'                  # YOUR SNAP VERSION GOES HERE
summary: example X11 kiosk      # YOUR SUMMARY GOES HERE
description: example X11 kiosk  # YOUR DESCRIPTION GOES HERE
base: core18
confinement: strict
grade: devel

apps:
  x11-tkinter-demo:
#    daemon: simple
#    restart-condition: always
	command-chain:
	  - env-setup
	  - bin/debian-multiarch-triplet-provider-launch
	  - bin/tcltk-launch
	command: usr/local/bin/x11_kiosk_launch $SNAP/bin/popup ### YOUR COMMAND GOES HERE

architectures:
  - build-on: amd64
  - build-on: arm64
  - build-on: armhf

parts:
  ### YOUR PART GOES HERE
  popup:
	plugin: python
   # python-version: python3
	source: demo-app/
	build-packages: [python3-tk] 
	stage-packages: [python3-tk]
	stage-snaps: [mir-kiosk-x11]

  debian-multiarch-triplet-provider-launch:
	plugin: nil
	stage-snaps:
	- debian-multiarch-triplet-provider-launch

  tcltk-launch:
	  plugin: nil
	  stage-snaps:
		- tcltk-launch    

# Needed by Mir and/or Xwayland
layout:
  /usr/share/X11:
	bind: $SNAP/usr/share/X11
  /usr/bin/xkbcomp:
	symlink: $SNAP/usr/bin/xkbcomp
  /usr/share/icons:
	bind: $SNAP/usr/share/icons
  /usr/share/fonts:
	bind: $SNAP/usr/share/fonts
  /etc/fonts:
	bind: $SNAP/etc/fonts

plugs:
  opengl:         # For Mir
  wayland:        # For Mir
  network-bind:   # For Mir (to serve X11)

When I set the base as core18, I get the following warnings while building:

This part is missing libraries that cannot be satisfied with any available stage-packages known to snapcraft:

-libffi.so.7
-libnettle.so.7
-libtinfo.so.6
These dependencies can be satisfied via additional parts or content sharing. Consider validating configured filesets if this dependency was built.

I followed this steps to set up the environment and when I run my snap, I get the following issue:

/snap/x11-tkinter-demo/x1/usr/local/bin/mir_kiosk_x11: error while loading shared libraries: libffi.so.7: cannot open shared object file: No such file or directory
/tmp/tmp.t6AEbCqa6r CLOSE_WRITE,CLOSE 
Traceback (most recent call last):
  File "/snap/x11-tkinter-demo/x1/bin/popup", line 3, in <module>
	import tkinter as tk
  File "/snap/x11-tkinter-demo/x1/usr/lib/python3.6/tkinter/__init__.py", line 36, in <module>
	import _tkinter # If this fails your Python may not be configured for Tk
ImportError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /snap/x11-tkinter-demo/x1/usr/lib/x86_64-linux-gnu/libpng16.so.16)
/snap/x11-tkinter-demo/x1/usr/local/bin/x11_kiosk_launch: 20: kill: No such process

When I set the base as core 20 , I do not get any errors while building but still get the ModuleNotFoundError: No module named 'tkinter' error when I run my snap.

The source code is available here

Any workarounds or modifications suggested for this issue?

1 Like