0

I'm using Buildroot 2023.2 to create an OS image (linux) for a Raspberry Pi Zero W (i.e., Arm). ImageMagick is an included package for BR, but Wand isn't. I used BR's scanpi utility, which basically uses pip to pull down packages from PyPI, to create a package recipe for Wand. When I then run 'make python-wand', it builds the package with no errors However, when running the image on the Pi, while I can 'import wand', if I try 'from wand.image import Image' I get the error:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/wand/api.py", line 154, in <module>
  File "/usr/lib/python3.11/site-packages/wand/api.py", line 143, in load_library
OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/wand/image.py", line 18, in <module>
  File "/usr/lib/python3.11/site-packages/wand/assertions.py", line 155, in <module>
  File "/usr/lib/python3.11/site-packages/wand/color.py", line 10, in <module>
  File "/usr/lib/python3.11/site-packages/wand/api.py", line 178, in <module>
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.

As you can see, it doesn't seem to have any paths to try (the ImageMagick libs are in /usr/lib, the executables in /usr/bin). I tried setting MAGIC_HOME=/usr/lib/ but that made no difference. It's almost as if Wand was compiled without any search path.

ImageMagick is version 7.1.0-51, if that matters, although I suspect it's a path problem. The installation docs for Wand mention that Alpine Linux needs to have symlinks manually made for the libMagickCore and libMagickWand libs, but I already have those:

ll /usr/lib/libMagick*
lrwxrwxrwx    1 root     root            30 Apr 12 13:43 /usr/lib/libMagick++-7.Q16HDRI.so -> libMagick++-7.Q16HDRI.so.5.0.0
lrwxrwxrwx    1 root     root            30 Apr 12 13:43 /usr/lib/libMagick++-7.Q16HDRI.so.5 -> libMagick++-7.Q16HDRI.so.5.0.0
-rwxr-xr-x    1 root     root        480556 Apr 12 13:58 /usr/lib/libMagick++-7.Q16HDRI.so.5.0.0
lrwxrwxrwx    1 root     root            33 Apr 12 13:43 /usr/lib/libMagickCore-7.Q16HDRI.so -> libMagickCore-7.Q16HDRI.so.10.0.0
lrwxrwxrwx    1 root     root            33 Apr 12 13:43 /usr/lib/libMagickCore-7.Q16HDRI.so.10 -> libMagickCore-7.Q16HDRI.so.10.0.0
-rwxr-xr-x    1 root     root       3002020 Apr 12 13:58 /usr/lib/libMagickCore-7.Q16HDRI.so.10.0.0
lrwxrwxrwx    1 root     root            33 Apr 12 13:43 /usr/lib/libMagickWand-7.Q16HDRI.so -> libMagickWand-7.Q16HDRI.so.10.0.0
lrwxrwxrwx    1 root     root            33 Apr 12 13:43 /usr/lib/libMagickWand-7.Q16HDRI.so.10 -> libMagickWand-7.Q16HDRI.so.10.0.0
-rwxr-xr-x    1 root     root       1058084 Apr 12 13:58 /usr/lib/libMagickWand-7.Q16HDRI.so.10.0.0

Suggestions?

glenhurst
  • 1
  • 1
  • Have a read here https://stackoverflow.com/a/71197779/2836621 – Mark Setchell Apr 13 '23 at 16:31
  • 2
    @MarkSetchell, that did it! I was already using the MAGICK_HOME setting, as mentioned, but was ignoring the WAND_MAGICK_LIBRARY_SUFFIX because I thought Wand already knew the suffix. Nevertheless, I tried setting WAND_MAGICK_LIBRARY=/usr/lib, and while it still failed the 'tried paths' was now filled in and showed that I needed to set MAGICK_HOME=/usr/, not /usr/lib. I exported MAGICK_HOME=/usr and then loaded python and it all worked. Thanks for your help. – glenhurst Apr 14 '23 at 19:00

0 Answers0