Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Last active June 22, 2024 22:10
Show Gist options
  • Save dongyuwei/3668fcc69f557dd32c46 to your computer and use it in GitHub Desktop.
Save dongyuwei/3668fcc69f557dd32c46 to your computer and use it in GitHub Desktop.
ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library.

Wand==0.3.7, Python 3.4.3, OSX EI Capitan 10.11

when run from wand.image import Image it throw errors:

ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: brew install freetype imagemagick

ok, first I try this:

brew install freetype imagemagick, but

Warning: freetype-2.6_1 already installed Warning: imagemagick-6.9.2-4 already installed

what's the fuck?

run convert -h

dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib Referenced from: /usr/local/bin/convert Reason: Incompatible library version: convert requires version 19.0.0 or later, but libfreetype.6.dylib provides version 16.0.0 Trace/BPT trap: 5

Ok, Incompatible library version, I got you!

So here is the final solutions for me.

  1. brew uninstall freetype imagemagick
  2. brew install freetype
  3. brew link --overwrite freetype
  4. brew install imagemagick
@KimDarren
Copy link

👎 This solution cannot solve my problem.

@Deimos620
Copy link

Deimos620 commented Oct 22, 2017

Don't work for me, too. :(

@Itsindigo
Copy link

I'm having this same issue on HighSierra 10.13.1 after accidentally running brew upgrade without an arg, which has upgraded all my packages and broken a lot of the symlinks it would seem.

brew uninstall freetype errors due to dependencies, and i'm hesitant to force it. Will report back if I figure out my issue.

@Itsindigo
Copy link

Turned out to be an issue with incompatible dependencies.

brew uninstall imagemagick@7 --force (force may or may not have been necessary here)

brew install imagemagick@6 && brew link imagemagick

This fixed my issue

@mnnit-geek
Copy link

@Itsindigo I did the same thing. I'm still getting the same error!

@yoshie902a
Copy link

yoshie902a commented Mar 17, 2018

I followed itsindigo's solution, but still have the same issue. No solution yet.

What version of python, imagemagick, freetype, pythonmagick, magickwand for you have running?

@shaleh
Copy link

shaleh commented Mar 19, 2018

On High Sierra I did this:

$ brew install imagemagick@6
$ export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/imagemagick@6/lib/
$ python -c "from wand.image import Image"  # If this works all is well. Failure is noisy

No need to uninstall imagemagick 7. However, you do need to set the variable somewhere like ~/.bash_profile or in your service's startup script.

Just imagemagick@7 does not work, even with the variable set to point to it. At least for me.

@vishul
Copy link

vishul commented Oct 11, 2018

@shaleh This works! I had imagemagick@6 installed but apparently the libPath was not set correctly. Thanks 👍 :)

@juliansrepository
Copy link

If anyone is still suffering, this worked for me:

export MAGICK_HOME=/opt/homebrew/opt/imagemagick

@vishk23
Copy link

vishk23 commented Mar 6, 2023

@juliansrepository THANKS !! only thing that worked

@Danzil21
Copy link

@juliansrepository thanks a lot, I spent a lot of time solving the problem, but everything turned out to be much easier)

@iqfareez
Copy link

If anyone is still suffering, this worked for me:

export MAGICK_HOME=/opt/homebrew/opt/imagemagick

Working for me. Thanks 👍

@vishnupriyavr
Copy link

If anyone is still suffering, this worked for me:

export MAGICK_HOME=/opt/homebrew/opt/imagemagick

Thanks, this works

@pythoninthegrass
Copy link

This was close. What worked for me was:

# install imagemagick v6
brew uninstall imagemagick
brew install imagemagick@6
brew unlink imagemagick
brew link imagemagick@6 --force

# ~/.bashrc
export BREW_PREFIX=$(brew --prefix)
export MAGICK_HOME="$BREW_PREFIX/opt/imagemagick@6"

now able to import pdftotree as expected on an M1 Pro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment