0

I am attempting to use the PDFPlumber library, which uses Wand's image format. However, upon trying to run:

from wand.image import Image

I get this error:

Traceback (most recent call last):
 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wand/api.py", line 151, in <module>
libraries = load_library()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wand/api.py", line 140, in load_library
raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: ['/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWandHDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWandHDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q8.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q8HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q8HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q16.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q16HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-7.Q16HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q16.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q16HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q16HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q8.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q8HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-Q8HDRI-2.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6.Q16.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6.Q16HDRI.dylib', '/opt/homebrew/opt/imagemagick@6/lib/lib/libMagickWand-6.Q16HDRI-2.dylib']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/wand/api.py", line 177, in <module>
'Try to install:\n  ' + msg)
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
    brew install freetype imagemagick

I first tried installing normally:

pip3 install wand
brew install imagemagick

Then, I tried using the method listed here, and tried the following:

pip3 install wand
brew uninstall imagemagick
brew install imagemagick@6
brew unlink imagemagick && brew link imagemagick@6

export MAGICK_HOME="/opt/homebrew/opt/imagemagick@6/"
export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"

but am still getting the same error.

I also tried the solutions listed here and confirmed that I am running 64-bit python 3.7 as mentioned here. How can I fix this? I'm especially confused because after running:

cd /opt/homebrew/opt/imagemagick@6/lib
ls

I can see that /opt/homebrew/opt/imagemagick@6/lib/libMagickWand-6.Q16.dylib is where Wand expects it to be (listed in the tried paths in the error above):

 ImageMagick                     libMagickCore-6.Q16.7.dylib     libMagickWand-6.Q16.a
libMagick++-6.Q16.9.dylib       libMagickCore-6.Q16.a           libMagickWand-6.Q16.dylib
libMagick++-6.Q16.a             libMagickCore-6.Q16.dylib       libMagickWand-6.Q16.la
libMagick++-6.Q16.dylib         libMagickCore-6.Q16.la          pkgconfig
libMagick++-6.Q16.la            libMagickWand-6.Q16.7.dylib
Moe
  • 1

0 Answers0