Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 557
userrr3 Avatar asked Jul 28 '14 19:07

userrr3


People also ask

Why can’t I find the Python module I installed?

This is caused by the fact that the version of Python you’re running your script with is not configured to search for modules where you’ve installed them. This happens when you use the wrong installation of pip to install packages.

What is the path of the shared library of ImageMagick?

Build a brand that will thrive online by easily turning your content into a business with Squarespace. The path of the shared Library is non existent. Just ensure that theibrary files are in the path mentioned Wand is a Python binding of ImageMagick, so you have to install it as well:

Why can’t I run a python script?

This is caused by the fact that the version of Python you’re running your script with is not configured to search for modules where you’ve installed them. This happens when you use the wrong installation of pip to install packages. In general, each Python installation comes bundled with its own pip executable

Is Image Magick 7 compatible with magick wand?

A few sources said that Image Magick 7.x is not compatible with magick Wand so make sure you're using 6.x. Additionally, "static" suffix versions do not work. The one that finally worked for me was "ImageMagick-6.9.8-10-Q8-x64-dll.exe"


2 Answers

Had a similar problem, checked that correct architecture was installed matching python 3.x and it still didnt work. I was able to get it to work by using a few steps and I thought I'd post it here consolidated in case anyone had similar problems.

A few sources said that Image Magick 7.x is not compatible with magick Wand so make sure you're using 6.x. Additionally, "static" suffix versions do not work. The one that finally worked for me was "ImageMagick-6.9.8-10-Q8-x64-dll.exe"

like image 151
gravity84 Avatar answered Oct 23 '22 09:10

gravity84


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 ^^

like image 21
userrr3 Avatar answered Oct 23 '22 10:10

userrr3