I am trying to package our python app aTrain, a local audio transcription GUI app based on whisper, as a snap. I actually got quite far, getting it to mostly run in devmode confinement. However, when I switched to strict confinement I got a problem with permissions for multiprocessing: File "/usr/lib/python3.12/multiprocessing/synchronize.py", line 57, in __init__ sl = self._semlock = _multiprocessing.SemLock( ^^^^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied I tried to implement the fix of using private shared memory proposed here https://forum.snapcraft.io/t/python-multiprocessing-sem-open-blocked-in-strict-mode/962 plugs: shared-memory: private: true However, this breaks the python app, giving me the following error: File "/snap/atrain/x1/lib/python3.12/site-packages/aTrain/routes.py", line 30, in home languages = model_languages(default_model) ^^^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'default_model' where it is not associated with a value Any ideas on how to solve that would be greatly welcome. Here are the two corresponding branches for the app and the backend. https://github.com/JuergenFleiss/aTrain/tree/feature_snap https://github.com/JuergenFleiss/atrain_core/tree/feature_snap To reproduce, clone the aTrain repository and switch to the feature snap branch, then run snapcraft to build (warning: takes a few GB). Below is also my snapcraft.yaml (also in the aTrain feature_snap branch) name: atrain summary: aTrain summary description: | A GUI tool for offline transcription of speech recordings, including speaker diarization, utilizing state-of-the-art machine learning models. version: test base: core24 confinement: strict parts: atrain: plugin: python source: . python-packages: - pyqt5 - pyqtwebengine - pywebview - pywebview[qt] - pycairo - PyGObject == 3.50.0 - lightning-utilities - numpy == 1.26.4 - packaging build-environment: - PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cu121 build-packages: - git - build-essential - libgl1-mesa-dev - libcairo2 - libcairo2-dev - libgirepository1.0-dev - libglu1-mesa - libwebkit2gtk-4.1-dev stage-packages: - libgl1 - libglx0 - libglvnd0 - libxau6 - libxdmcp6 - libx11-6 - libavfilter-dev - libxcb-randr0-dev - libxcb-xtest0-dev - libxcb-xinerama0-dev - libxcb-shape0-dev - libxcb-xkb-dev - libavcodec-dev - libavcodec-extra - libavutil-dev - libavfilter-dev - libavformat-dev - libxcb-xinput0 - qtcreator - qtbase5-dev - qt5-qmake - cmake apps: atrain: command: bin/aTrain start plugs: - desktop - desktop-legacy - opengl - x11 - wayland - network - network-bind - network-status - browser-support extensions: [gnome] environment: LD_LIBRARY_PATH: $SNAP/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/:$LD_LIBRARY_PATH # "PYTHONPATH": "$NAP/usr/lib/python3/dist-packages/" hooks: install: plugs: [network] Continue reading...