As far I undertood, to use a debian package from apt, in runtime, I only need to add the name of package in stage-packages.
It seems It worked, my snap contains the package.
But if I shell my virtual machine using: multipass shell snapcraft-tkedit
And I try calling Python3 <somescript.py> that uses the package, It returns ModuleNotFoundError.
my snapcraft.yaml
name: tkedit
type: "app"
base: core20
apps:
tkedit:
command: bin/tkedit
parts:
tkedit:
source: /home/element/tkedit
source-type: local
plugin: python
stage-packages: [python3-tk]
When installing the environment, the message appears ok:
Get:1 python3-tk_3.8.10-0ubuntu1~20.04_amd64.deb [104 kB]
Fetched 0 B in 0s (0 B/s)
When I call the app from my shell in my host OS:
❯ tkedit
Traceback (most recent call last):
File "/snap/tkedit/x3/bin/tkedit", line 5, in <module>
from texteditor import main
File "/snap/tkedit/x3/lib/python3.8/site-packages/texteditor.py", line 2, in <module>
import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
the module is in the folder:
/snap/tkedit/x3/usr/lib/python3.8/tkinter