Good morning,
After a lot of attemps running
from wand.image import Image I get the following error:
Traceback (most recent call last): File "C:\Users\XXXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 180, in <module> libraries = load_library() File "C:\Users\XXXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 135, in load_library raise IOError('cannot find library; tried paths: ' + repr(tried_paths)) OSError: cannot find library; tried paths: ['C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWandHDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWandHDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-Q8HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-Q8HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16HDRI.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\CORE_RL_wand_-6.Q16HDRI-2.dll', 'C:\\Program Files\\ImageMagick-6.9.9-Q8\\libMagickWand-6.Q16HDRI-2.dll'] During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Users\xxxxx\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\image.py", line 20, in <module> from .api import MagickPixelPacket, libc, libmagick, library File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Users\XXXX\PycharmProjects\PDF_convert\venv\lib\site-packages\wand\api.py", line 206, in <module> 'Try to install:\n ' + msg) ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: I have tried everything: 1. Install the most recent binaries ImageMagick-6.9.9-40-Q8-x64-dll (1).exe (checking the required options) 2. Define MAGICK_HOME path as: C:\Program Files\ImageMagick-6.9.9-Q8 3. Restart computer
and still giving me this error.
I'm using windows 10,
Can someone help me with this error? I really need to use this library for scanned ocr pdf.
Thanks in advance!win
18 Answers
Refer to this answer here. I had the same problem but I had a 32bit version of Python so I had to download the x86 version of ImageMagick.
I faced the same issue on my Windows laptop to solve it I followed the following steps:
Run one of the following commands:
!conda install -c conda-forge/label/cf202003 imagemagick !pip install install libmagickwand-dev !pip install ImageMagick After this implement the steps mentioned on the following link:
#Install ImageMagick on Windows by following this page:
I have downloaded and installed ImageMagick-7.1.0-2-Q16-HDRI-x64-dll.exe
Restarted the kernel of my jupyter notebook. It solved my issue.
Note:
I am keeping this answer on this post and I have removed a similar answer from the Error: MagickWand shared library not found. You probably had not installed ImageMagick library. (even though I have)
2For those who are in Linux
You also need to install magickwand from apt-get:
sudo apt-get install libmagickwand-dev On windows, installing the 32bit version has worked for me, however, the link on wand's website is dead for some server reason. I have been able to make it work by installing from the binaries list.
Even installing the correct version (32-bit / 64-bit) of ImageMagick 7.X.X, I still got the ImportError: MagickWand shared library not found error. For my version of Wand==0.4.5, what helped for me was uninstalling ImageMagick, then installing a 6.9.X version. You may find the list of releases here.
For Python v3 (64 bit),
try installing ImageMagick-6.9.10-2-Q16-x64-dll.exe from here then put installed directory file path in Path environment variable, ex - C:\Program Files\ImageMagick-6.9.10-Q16
then install wand pip install wand==0.4.4
this should fix the issue as there are compatibility issues with wand and ImageMagick
Don't get confused check for correct Python Version:
Not the Windows 32/64bit matters what matters is which Python Verison is installed 32/64bit
To get the correct version:
python -VV
>>> Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)]
Find the correct version x64 for 64bit x86 for 32bit Python:
Get -dll.exe version...
Note that you have to check Install development headers and libraries for C and C++ to make Wand able to link to it.
Lastly you have to set MAGICK_HOME environment variable to the path of ImageMagick (e.g. C:\Program Files\ImageMagick-6.9.3-Q16). You can set it in Computer ‣ Properties ‣ Advanced system settings ‣ Advanced ‣ Environment Variables….
If you like to convert images like me you need to install Ghostscript in addition:
For those coming from Mac
After installing ImageMagick, MAGICK_HOME and PATH needs to be set
brew install freetype ImageMagick export MAGICK_HOME=/opt/homebrew/opt/imagemagick/ export PATH=$MAGICK_HOME/bin:$PATH Now executing python from the same shell should pickup ImageMagick/MagickWand
Restart the shell if export statements are added to zshrc