{"action":"created","issue":{"url":"https://api.github.com/repos/jsvine/pdfplumber/issues/81","repository_url":"https://api.github.com/repos/jsvine/pdfplumber","labels_url":"https://api.github.com/repos/jsvine/pdfplumber/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/jsvine/pdfplumber/issues/81/comments","events_url":"https://api.github.com/repos/jsvine/pdfplumber/issues/81/events","html_url":"https://github.com/jsvine/pdfplumber/issues/81","id":358770424,"node_id":"MDU6SXNzdWUzNTg3NzA0MjQ=","number":81,"title":"Visual debugging fails -- ImportError: MagickWand shared library not found","user":{"login":"cjwinchester","id":3728252,"node_id":"MDQ6VXNlcjM3MjgyNTI=","avatar_url":"https://avatars2.githubusercontent.com/u/3728252?v=4","gravatar_id":"","url":"https://api.github.com/users/cjwinchester","html_url":"https://github.com/cjwinchester","followers_url":"https://api.github.com/users/cjwinchester/followers","following_url":"https://api.github.com/users/cjwinchester/following{/other_user}","gists_url":"https://api.github.com/users/cjwinchester/gists{/gist_id}","starred_url":"https://api.github.com/users/cjwinchester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjwinchester/subscriptions","organizations_url":"https://api.github.com/users/cjwinchester/orgs","repos_url":"https://api.github.com/users/cjwinchester/repos","events_url":"https://api.github.com/users/cjwinchester/events{/privacy}","received_events_url":"https://api.github.com/users/cjwinchester/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-10T19:56:27Z","updated_at":"2018-09-11T13:08:16Z","closed_at":null,"author_association":"NONE","body":"Hello! First, thanks to everyone who contributes to this library -- we use it all the time and it is _fantastic_.\r\n\r\nMy problem: I'm getting an import error when I try to use the `to_image()` method on a PDF page.\r\n\r\nHere's the code that fails:\r\n\r\n```python\r\nimport pdfplumber as pp\r\n\r\nFILE = 'path/to/my/file.pdf'\r\n\r\nwith pp.open(FILE) as pdf:\r\n    test = pdf.pages[0]\r\n    crop = (0, 100, 295, test.height-100)\r\n    cropped_page = test.crop(crop)\r\n    cropped_page.to_image()\r\n```\r\n\r\nHere's the traceback -- I think it's throwing up when the code calls `import wand.image`:\r\n\r\n```python-traceback\r\nOSError                                   Traceback (most recent call last)\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/wand/api.py in <module>()\r\n    179 try:=-\r\n--> 180     libraries = load_library()\r\n    181 except (OSError, IOError):\r\n\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/wand/api.py in load_library()\r\n    134         return libwand, libmagick\r\n--> 135     raise IOError('cannot find library; tried paths: ' + repr(tried_paths))\r\n    136 \r\n\r\nOSError: cannot find library; tried paths: []\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nImportError                               Traceback (most recent call last)\r\n<ipython-input-37-4c7bb7edc98c> in <module>()\r\n      3     crop = (0, 100, 295, test.height - 100)\r\n      4     cropped_page = test.crop(crop)\r\n----> 5     cropped_page.to_image()\r\n      6 \r\n\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/pdfplumber/page.py in to_image(self, resolution)\r\n    214         For conversion_kwargs, see http://docs.wand-py.org/en/latest/wand/image.html#wand.image.Image\r\n    215         \"\"\"\r\n--> 216         from .display import PageImage, DEFAULT_RESOLUTION\r\n    217         res = resolution or DEFAULT_RESOLUTION\r\n    218         return PageImage(self, resolution=res)\r\n\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/pdfplumber/display.py in <module>()\r\n      1 import PIL.Image\r\n      2 import PIL.ImageDraw\r\n----> 3 import wand.image\r\n      4 import sys, os\r\n      5 from io import BytesIO\r\n\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/wand/image.py in <module>()\r\n     18 \r\n     19 from . import compat\r\n---> 20 from .api import MagickPixelPacket, libc, libmagick, library\r\n     21 from .color import Color\r\n     22 from .compat import (binary, binary_type, encode_filename, file_types,\r\n\r\n~/.virtualenvs/bga-ttQ8tdNt/lib/python3.7/site-packages/wand/api.py in <module>()\r\n    204     raise ImportError('MagickWand shared library not found.\\n'\r\n    205                       'You probably had not installed ImageMagick library.\\n'\r\n--> 206                       'Try to install:\\n  ' + msg)\r\n    207 \r\n    208 #: (:class:`ctypes.CDLL`) The MagickWand library.\r\n\r\nImportError: MagickWand shared library not found.\r\nYou probably had not installed ImageMagick library.\r\nTry to install:\r\n  brew install freetype imagemagick\r\n```\r\n\r\nI'm on a Macbook Pro running High Sierra and Python 3.7. I'm using pipenv to manage dependencies (but I get the same error when I try it in a basic virtualenv).\r\n\r\n```\r\n$ pipenv shell\r\n$ python --version\r\nPython 3.7.0\r\n```\r\n\r\nHere's my Pipfile:\r\n\r\n```\r\n$ cat Pipfile\r\n[[source]]\r\nurl = \"https://pypi.org/simple\"\r\nverify_ssl = true\r\nname = \"pypi\"\r\n\r\n[packages]\r\njupyter = \"*\"\r\npdfplumber = \"*\"\r\nwand = \"*\"\r\n\r\n[dev-packages]\r\n\r\n[requires]\r\n```\r\n\r\nI've confirmed that imagemagick and freetype are installed and working:\r\n\r\n```\r\n$ brew list freetype --versions\r\nfreetype 2.9.1 2.9\r\n\r\n$ brew list imagemagick --versions\r\nimagemagick 7.0.7-28 7.0.7-21 7.0.7-27 7.0.6-10 7.0.8-11_1 7.0.7-32 7.0.7-25 7.0.7-23 7.0.5-4\r\n```\r\n\r\nAny advice would be greatly appreciated. Thanks again!"},"comment":{"url":"https://api.github.com/repos/jsvine/pdfplumber/issues/comments/420268045","html_url":"https://github.com/jsvine/pdfplumber/issues/81#issuecomment-420268045","issue_url":"https://api.github.com/repos/jsvine/pdfplumber/issues/81","id":420268045,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMDI2ODA0NQ==","user":{"login":"jsvine","id":534702,"node_id":"MDQ6VXNlcjUzNDcwMg==","avatar_url":"https://avatars2.githubusercontent.com/u/534702?v=4","gravatar_id":"","url":"https://api.github.com/users/jsvine","html_url":"https://github.com/jsvine","followers_url":"https://api.github.com/users/jsvine/followers","following_url":"https://api.github.com/users/jsvine/following{/other_user}","gists_url":"https://api.github.com/users/jsvine/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvine/subscriptions","organizations_url":"https://api.github.com/users/jsvine/orgs","repos_url":"https://api.github.com/users/jsvine/repos","events_url":"https://api.github.com/users/jsvine/events{/privacy}","received_events_url":"https://api.github.com/users/jsvine/received_events","type":"User","site_admin":false},"created_at":"2018-09-11T13:08:16Z","updated_at":"2018-09-11T13:08:16Z","author_association":"OWNER","body":"Thanks for the kind words, Cody, and a special thanks for the helpful details. \r\n\r\nI recall the following fix having worked for me: https://stackoverflow.com/questions/37011291/python-wand-image-is-not-recognized/41772062#41772062\r\n\r\nDoes it work for you? If so, I can add a note to the readme."}}
{"actor":{"display_login":"jsvine"}}