Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing no delegate module error while snapping this app #24

Closed
soumyaDghosh opened this issue Jun 10, 2023 · 8 comments
Closed

Facing no delegate module error while snapping this app #24

soumyaDghosh opened this issue Jun 10, 2023 · 8 comments
Labels
packaging Issues with packaging Halftone

Comments

@soumyaDghosh
Copy link

Hii, I have been trying to snap this app. The GUI shows up, but, whenever I add any kind of image file, I face this error.

Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/snap/halftone/current/usr/share/halftone/halftone/utils/killable_thread.py", line 27, in _run
    self._run_backup()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/snap/halftone/current/usr/share/halftone/halftone/views/dither_page.py", line 139, in update_preview_image
    self.preview_image_path = HalftoneImageMagick().dither_image(path, self.output_options)
  File "/snap/halftone/current/usr/share/halftone/halftone/backend/magick.py", line 21, in dither_image
    with Image(filename=path) as img:
  File "/snap/halftone/x15/usr/lib/python3.10/dist-packages/wand/image.py", line 9365, in __init__
    self.read(filename=filename)
  File "/snap/halftone/x15/usr/lib/python3.10/dist-packages/wand/image.py", line 10120, in read
    self.raise_exception()
  File "/snap/halftone/x15/usr/lib/python3.10/dist-packages/wand/resource.py", line 225, in raise_exception
    raise e
wand.exceptions.MissingDelegateError: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/781

In the snap, magick is installed same way as it's done in flatpak. At first I facing the same issue but with 'JPG' instead of 'PNG'
Later, I added

      - --with-modules=yes
      - --enable-delegate-build=yes
      - --with-png=yes

But, now I am getting this error. But, the snap itself still have all the same files and libraries as the flatpak. Am I missing anything, or any ENVIRONMENT VARIABLE is missing to point towards the magick libraries.

This is the snapcraft.yaml for your help:

name: halftone # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
adopt-info: halftone
version: '0.2.0'
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots

parts:     
  magick:
    plugin: autotools
    source: https://github.com/ImageMagick/ImageMagick.git
    source-commit: "920f79206ff59f30a4cff22c9c9c393508b82663"
    autotools-configure-parameters:
      - --prefix=/usr
      - --with-heic=yes
      - --with-rsvg=yes 
      - --with-modules=yes
      - --enable-delegate-build=yes
      - --with-png=yes
    prime:
      - -usr/lib/pkgconfig
      - -usr/include
      - -usr/share
  halftone:
    after: [ magick ]
    # See 'snapcraft plugins'
    plugin: meson
    source: https://github.com/tfuxu/Halftone.git
    source-tag: '0.3.0'
    meson-parameters:
      - --prefix=/snap/halftone/current/usr
      - -Dbuildtype=release
    override-pull: |
      craftctl default
      patch -p1 < $CRAFT_PROJECT_DIR/halftone.patch
      pip install --prefix=$CRAFT_PART_INSTALL/usr Wand
    build-packages:
      - blueprint-compiler
      - execstack
    stage-packages:
      - libjpeg62
    override-build: |
      craftctl default
      mkdir -p $CRAFT_PART_INSTALL/meta/gui
      cp -r $CRAFT_PART_INSTALL/snap/halftone/current/usr/share/icons $CRAFT_PART_INSTALL/meta/gui/
      for i in `find $CRAFT_PART_INSTALL/meta/gui/icons -name "*.svg" -o -name "*.png"`; do
        mv $i "`dirname $i`/snap.$CRAFT_PROJECT_NAME.`basename $i`"
      done
    override-prime: |
      craftctl default
      if [ "$CRAFT_ARCH_TRIPLET" = "arm-linux-gnueabihf" ]; then
      execstack --clear-execstack usr/lib/arm-linux-gnueabihf/libde265.so.0.1.1
      fi
    parse-info: [usr/share/appdata/io.github.tfuxu.Halftone.appdata.xml]
    organize:
      snap/halftone/current: .
      usr/local: usr
      usr/lib/python3: usr/lib/python3.10
    prime:
      - -snap/halftone
slots:
  halftone:
    interface: dbus
    bus: session
    name: io.github.tfuxu.Halftone
apps:
  halftone:
    command: usr/bin/halftone
    common-id: io.github.tfuxu.Halftone
    extensions: [gnome]
    environment:
      PYTHONPATH: $SNAP/usr/lib/python3.10/dist-packages:$PYTHONPATH
      MAGICK_HOME: $SNAP/usr
      MAGICK_CODER_MODULE_PATH: $SNAP/usr/lib/
    plugs:
      - home
@tfuxu tfuxu added the bug Something isn't working label Jun 10, 2023
@tfuxu
Copy link
Owner

tfuxu commented Jun 10, 2023

You might want to wait a little bit longer with making a snap package, as I'm going to replace ImageMagick with Pillow in the next release, so all of this workarounds won't be probably needed in 0.4.0.

BTW, if you still want to make this work, I found this topic on Snapcraft's forum: https://forum.snapcraft.io/t/the-imagemagick-remote-part/9003

@soumyaDghosh
Copy link
Author

Thank you.. I must wait then. Cause making complicated things just for one release is not a good choice I guess.

@tfuxu tfuxu added packaging Issues with packaging Halftone and removed bug Something isn't working labels Jun 12, 2023
@tfuxu tfuxu added this to the Halftone 0.5.0 milestone Jun 17, 2023
@tfuxu
Copy link
Owner

tfuxu commented Jul 7, 2023

@soumyaDghosh If you want, you can work on snap package for the current release, as it seems that issue #28 will be harder do implement than I initially thought. There's just a lot of bugs and deprecated code in hitherdither which I need to fix before bundling it in Halftone.

@tfuxu tfuxu modified the milestones: Halftone 0.4.0, Halftone 1.0.0 Nov 11, 2023
@soumyaDghosh
Copy link
Author

Hi @tfuxu I am very sorry, I took so much time. Actually got frustrated with the magick's delegate not found error. But, finally, almost a year later, I sat with it again and guess what? I have made it!!!!!

Even though the version is 0.6.0 for now(no gnome 46 yet in snaps, still in testing phase), it works! and works perfectly.

@tfuxu
Copy link
Owner

tfuxu commented May 25, 2024

Glad to hear that!

@soumyaDghosh
Copy link
Author

Glad to hear that!

Would you like to add a badge about the package in your repo? Or want to make it an official one?

@tfuxu
Copy link
Owner

tfuxu commented May 26, 2024

Would you like to add a badge about the package in your repo?

Added in #73

@soumyaDghosh
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging Issues with packaging Halftone
Projects
None yet
Development

No branches or pull requests

2 participants