Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use or install MagickWand on Mac OS X?

I have problem with magickwand and python and Mac OX X.

When I'm importing it I get the error:

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

brew install imagemagick Warning: imagemagick-6.8.9-1 already installed
like image 320
Sławek Kabik Avatar asked Jul 17 '14 12:07

Sławek Kabik


People also ask

Where is ImageMagick installed on Mac?

If ImageMagick is installed via MacPorts, then the convert command lives in /opt/local/bin/. It is this directory that needs to get on the PATH environment variable.


4 Answers

brew uninstall --force imagemagick

brew install imagemagick@6

echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.bash_profile

brew link imagemagick@6 --force
like image 192
Gowtham Balusamy Avatar answered Sep 23 '22 09:09

Gowtham Balusamy


So, the actual problem is :

If your Python in not installed using MacPorts, you have to export MAGICK_HOME path as well. Because Python that is not installed using MacPorts doesn’t look up /opt/local, the default path prefix of MacPorts packages.

from wand doc

And the solution they provide is :

$ export MAGICK_HOME=/opt/local

like image 28
jrjc Avatar answered Sep 24 '22 09:09

jrjc


To get Wand working with imagemagick 7:

brew install imagemagick
echo 'export MAGICK_HOME=/opt/homebrew/opt/imagemagick/' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/imagemagick/bin:$PATH"' >> ~/.zshrc
like image 33
Ribena Avatar answered Sep 26 '22 09:09

Ribena


Based on Gowtham's & jrjc's answers, here's how I got the Wand python package to work using homebrew:

brew install imagemagick@6

echo 'export MAGICK_HOME=/usr/local/opt/imagemagick@6/' >> ~/.bash_profile

There's a few things to note here:

  • wand at the time of this writing doesn't yet support imagemagick 7, see https://github.com/dahlia/wand/issues/316 .
  • MAGICK_HOME seems to be the better way to set the variable - it's mentioned in the wand docs as jrjr's answer mentioned, and if you're really curious you can see how Wand looks for things in api.py under the library_paths method. I couldn't get Gowtham's approach of exporting the bin directory to work.
like image 37
Vivek Gani Avatar answered Sep 23 '22 09:09

Vivek Gani