Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with wand import not being found #67

Open
kevflynn opened this issue May 18, 2023 · 1 comment
Open

Issue with wand import not being found #67

kevflynn opened this issue May 18, 2023 · 1 comment

Comments

@kevflynn
Copy link

  • pydngconverter version: latest
  • Python version: 3.10
  • Operating System: Mac OS Silicon

Description

I am trying to run the example code on my machine to convert a raw file to a DNG and I'm getting an error about the wand import not being found

What I Did

Code

import asyncio
import sys
from pydngconverter import DNGConverter, flags


async def main():
    # Create converter instance.
    pydng = DNGConverter(
        sys.argv[1],
        dest="/dngfiles",
        jpeg_preview=flags.JPEGPreview.EXTRACT,
        fast_load=True,
    )
    # Convert all
    return await pydng.convert()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Command

python dngconvert.py public/test.ARW

Traceback

/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py:18: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
[10:41:18] INFO     pydngconverter.utils: resolved executable for: Adobe DNG Converter @ /Applications/Adobe compat.py:151
                    DNG Converter.app/Contents/MacOS/Adobe DNG Converter                                                  
           INFO     pydngconverter.utils: resolved executable for: exiftool @ /opt/homebrew/bin/exiftool     compat.py:151
Traceback (most recent call last):
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 154, in <module>
    libraries = load_library()
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 143, 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 "/Users/flynn/anaconda3/lib/python3.10/site-packages/pydngconverter/main.py", line 17, in <module>
    from wand.image import Image
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/image.py", line 18, in <module>
    from . import assertions
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/assertions.py", line 155, in <module>
    from .color import Color  # noqa: E402
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/color.py", line 10, in <module>
    from .api import library
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 178, 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:
  brew install freetype imagemagick

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py", line 19, in <module>
    loop.run_until_complete(main())
  File "/Users/flynn/anaconda3/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py", line 8, in main
    pydng = DNGConverter(
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/pydngconverter/main.py", line 90, in __init__
    raise RuntimeError(
RuntimeError: Cannot use JPEG Preview EXTRACT because wand failed to import!
Warning: imagemagick 7.1.1-9 is already installed and up-to-date.
To reinstall 7.1.1-9, run:
  brew reinstall imagemagick
@BradenM
Copy link
Owner

BradenM commented May 18, 2023

Hi @kevflynn, thanks for the detailed report.

First, I do want to mention that Wand is only required (and is conditionally imported for) using the flags.JPEGPreview.EXTRACT flag. This flag is an alternative to the dng converter built in jpeg extraction (available to use via JPEGPreview.MEDIUM/FULL) or can be disabled all together via JPEGPreview.NONE.

If you do require/want the EXTRACT method, I would recommend digging through the Wand docs:
https://docs.wand-py.org/en/latest/guide/install.html#install-imagemagick-on-mac

This issue is more of a Wand problem rather than a pydngconverter issue, but if you are still running into problems here, I am glad to try to help out. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants