0

I am trying to install Wand for Python 3, which for me is accessed through my Cygwin installation.

I first tried installing Wand:

# Install Wand
#--------------
# https://docs.wand-py.org/en/0.6.6/guide/install.html
$ python -m pip install Wand
Defaulting to user installation because normal site-packages is not writeable
Collecting Wand
  Downloading Wand-0.6.6-py2.py3-none-any.whl (138 kB)
     |████████████████████████████████| 138 kB 1.5 MB/s
Installing collected packages: Wand
Successfully installed Wand-0.6.6
WARNING: You are using pip version 21.0; however, version 21.0.1 is available.
You should consider upgrading via the '/bin/python -m pip install --upgrade pip' command.

I then tried importing Image but got errors:

# Try importing from Wand
#------------------------
# https://docs.wand-py.org/en/0.6.6/guide/read.html#open-an-image-file
$ python
>>> from wand.image import Image
Traceback (most recent call last):
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/api.py", line 151, in <module>
    libraries = load_library()
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/api.py", line 140, in load_library
    raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/image.py", line 18, in <module>
    from . import assertions
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/assertions.py", line 155, in <module>
    from .color import Color  # noqa: E402
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/color.py", line 10, in <module>
    from .api import library
  File "/home/User.Name/.local/lib/python3.8/site-packages/wand/api.py", line 175, in <module>
    raise ImportError('MagickWand shared library not found.\n'
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
  https://docs.wand-py.org/en/latest/guide/install.html

The contents of the cited installation page is identical to the installation page I used above.

Can someone please advise on a next step to try?

Thanks.


Troubleshooting

Checked that I have Magick[Wand] libraries installed:

# Check what Wand/Magick things are installed
#--------------------------------------------
$ cygcheck -c -d | sed -n -e '/[Ww]and/p' -e '/[Mm]agick/p' | sort -u
ImageMagick                         7.0.10.27-2
libGraphicsMagick++12               1.3.36-2
libGraphicsMagick3                  1.3.36-2
libGraphicsMagickWand2              1.3.36-2
libMagickC++6_8                     6.9.10.11-4
libMagickCore6_6                    6.9.10.11-4
libMagickCore7_7                    7.0.10.27-2
libMagickWand6_6                    6.9.10.11-4
libMagickWand7_7                    7.0.10.27-2

Confirmed installation of Wand:

$ls -l ~/.local/lib/python3.8/site-packages/*
/home/User.Name/.local/lib/python3.8/site-packages/wand:
total 601
-rw-------  1 User.Name None    202 2021-04-18 01:04 __init__.py
drwx------+ 1 User.Name None      0 2021-04-18 01:04 __pycache__/
-rw-------  1 User.Name None   9844 2021-04-18 01:04 api.py
-rw-------  1 User.Name None   4721 2021-04-18 01:04 assertions.py
drwx------+ 1 User.Name None      0 2021-04-18 01:04 cdefs/
-rw-------  1 User.Name None  24508 2021-04-18 01:04 color.py
-rw-------  1 User.Name None   4570 2021-04-18 01:04 compat.py
-rw-------  1 User.Name None   2449 2021-04-18 01:04 display.py
-rw-------  1 User.Name None  77010 2021-04-18 01:04 drawing.py
-rw-------  1 User.Name None  11165 2021-04-18 01:04 exceptions.py
-rw-------  1 User.Name None   4021 2021-04-18 01:04 font.py
-rw-------  1 User.Name None 412660 2021-04-18 01:04 image.py
-rw-------  1 User.Name None  11663 2021-04-18 01:04 resource.py
-rw-------  1 User.Name None  13183 2021-04-18 01:04 sequence.py
-rw-------  1 User.Name None  10453 2021-04-18 01:04 version.py

/home/User.Name/.local/lib/python3.8/site-packages/Wand-0.6.6.dist-info:
total 15
-rw------- 1 User.Name None    4 2021-04-18 01:04 INSTALLER
-rw------- 1 User.Name None 1183 2021-04-18 01:04 LICENSE
-rw------- 1 User.Name None 3850 2021-04-18 01:04 METADATA
-rw------- 1 User.Name None 3406 2021-04-18 01:04 RECORD
-rw------- 1 User.Name None    0 2021-04-18 01:04 REQUESTED
-rw------- 1 User.Name None    5 2021-04-18 01:04 top_level.txt
-rw------- 1 User.Name None  110 2021-04-18 01:04 WHEEL

The time-stamp of the files match the approximate time of installation.

Confirmed that sys.path includes ~/.local/lib/python3.8/site-packages:

$ python
>>> import sys
>>> for path in sys.path:
...    print(path)
... 

/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/User.Name/.local/lib/python3.8/site-packages
/usr/lib/python3.8/site-packages
user36800
  • 2,019
  • 2
  • 19
  • 34

1 Answers1

0

This answer might help:

https://stackoverflow.com/a/26088037/2090942

Check if the version of python on your system is 32-bit or 64-bit. If you have a 32-bit version, try installing the 64-bit version and then check.

Noopur Phalak
  • 878
  • 1
  • 13
  • 22
  • My Cygwin installation is 64-bit, so all the `ImageMagick` and `MagickWand` libraries are also 64-bit. Wouldn't `pip` seek out the 64-bit `Wand`? How can I determine whether the `pip`-installed `Wand` is 64-bit? – user36800 Apr 18 '21 at 14:12