Python doesn't find MagickWand Libraries (despite correct location?)

userrr3 picture userrr3 · Jul 28, 2014 · Viewed 15.7k times · Source

I wanted to install the Python ImageMagick API wand and followed this site:

http://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-windows

However, when running a very simple test:

from wand.image import Image

I get the following output:

Traceback (most recent call last):

File "F:\PATHTO\Python34\lib\site-packages\wand\api.py", line 137, in libraries = load_library()

File "F:\PATHTO\Python34\lib\site-packages\wand\api.py", line 107, in load_library raise IOError('cannot find library; tried paths: ' + repr(tried_paths))

OSError: cannot find library; tried paths: ['F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_HDRI.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-Q16.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-Q16HDRI.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-Q8.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-Q8HDRI.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-6.Q16.dll', 'F:\PATHTO\ImageMagick-6.8.9-Q16\CORE_RL_wand_-6.Q16HDRI.dll']

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\PATHTO\Python\test.py", line 1, in import wand.image

File "F:\PATHTO\Python34\lib\site-packages\wand\image.py", line 20, in from .api import MagickPixelPacket, libc, libmagick, library

File "F:\PATHTO\Python34\lib\site-packages\wand\api.py", line 161, in 'Try to install:\n ' + msg)

ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: http://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-windows

The is though, that the files that were tried to be found (e.g. CORE_RL_wand_.dll) are in the very place that they were not found in. So it seems I set the MAGICK_HOME env. variable correctly.

However (what seems to be displayed incorrectly) the paths to the wand api and to my Python installation are displayed with a single backslash in my commandline, while the paths to the ImageMagick folder are displayed with two of them.

I don't understand why this is the case (the env. variable uses single backslashes as in the linked site) and I don't know whether this is the problem or even related to it.

Answer

userrr3 picture userrr3 · Sep 28, 2014

I solved my own problem after THINKING about it ;)

I had the 32bit version of Python and the 64bit version of ImageMagick... after uninstalling ImageMagick and installing the 32bit version everything is fine.

Maybe this helps someone who runs into the same problem and comes here via Google ^^