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

mountain lion install problem #44

Closed
scottgwald opened this Issue Aug 23, 2012 · 28 comments

Comments

@scottgwald

scottgwald commented Aug 23, 2012

Hello,

Maybe I'm missing a step, but I got the same result on multiple machines:

sudo port install ImageMagick => successful
sudo easy_install wand => successful

then in python interactive mode:
from wand.image import Image

throws error:

Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.8-intel/egg/wand/image.py", line 19, in
File "build/bdist.macosx-10.8-intel/egg/wand/api.py", line 266, in
ImportError: MagickWand shared library not found or incompatible

Am I missing a step?

Thanks!

@wronglink

This comment has been minimized.

Contributor

wronglink commented Aug 24, 2012

Looks strange. The same steps work fine for me.
Try to find file named libMagickWand.dylib (it is probably located at /opt/local/lib/ directory).
By the way, is you python version installed from macports or it's Mac OS built-in?

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 24, 2012

What is your $MAGICK_HOME and $DYLD_LIBRARY_PATH?

@scottgwald

This comment has been minimized.

scottgwald commented Aug 24, 2012

Michael,

(1) I've got /opt/local/lib/libMagickWand.dylib
(2) I'm using /Library/Frameworks/Python.framework/Versions/2.7/bin/python

Thanks,
Scott

On Fri, Aug 24, 2012 at 12:32 AM, Michael Elovskikh <
notifications@github.com> wrote:

Looks strange. The same steps work fine for me.
Try to find file named libMagickWand.dylib (it is probably located at
/opt/local/lib/ directory).
By the way, is you python version installed from macports or it's Mac OS
built-in?


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-7991967.

@scottgwald

This comment has been minimized.

scottgwald commented Aug 24, 2012

Neither one of these appears to be set.

Thanks,
Scott

On Fri, Aug 24, 2012 at 2:42 AM, Hong Minhee notifications@github.comwrote:

What is your $MAGICK_HOME and $DYLD_LIBRARY_PATH?


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-7993608.

@scottgwald

This comment has been minimized.

scottgwald commented Aug 24, 2012

Update:
I accidentally discovered that if I run python from /opt/local/lib, it works. So the problem is definitely just a path variable somewhere.

I tried setting MAGICK_HOME=/opt/local/lib and DYLD_LIBRARY_PATH=/opt/local/lib, but that didn't have any effect.

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 24, 2012

@swgreen You should set MAGICK_HOME=/opt/local instead of /opt/local/lib.

@scottgwald

This comment has been minimized.

scottgwald commented Aug 24, 2012

Okay, I tried that now and it didn't have any effect.

$ echo $MAGICK_HOME
/opt/local
$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from wand.image import Image
Traceback (most recent call last):
File "", line 1, in
File "build/bdist.macosx-10.8-intel/egg/wand/image.py", line 19, in

File "build/bdist.macosx-10.8-intel/egg/wand/api.py", line 266, in

ImportError: MagickWand shared library not found or incompatible

On Fri, Aug 24, 2012 at 6:01 PM, Hong Minhee notifications@github.comwrote:

@swgreen https://github.com/swgreen You should set
MAGICK_HOME=/opt/local instead of /opt/local/lib.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-8016117.

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Aug 24, 2012

@swgreen Can you insert import traceback; traceback.print_exc() between 265–266 and then paste the printed traceback here?

@scottgwald

This comment has been minimized.

scottgwald commented Aug 31, 2012

Sorry for the delay. I'm back on the case. Here's the traceback.

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from wand.image import Image
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/wand/api.py", line 93, in
library.NewMagickWand.restype = ctypes.c_void_p
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/init.py",
line 366, in getattr
func = self.getitem(name)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/init.py",
line 371, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, NewMagickWand): symbol not found
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/wand/image.py", line 19, in

from .api import MagickPixelPacket, libc, libmagick, library
File "/Library/Python/2.7/site-packages/wand/api.py", line 267, in

raise ImportError('MagickWand shared library not found or incompatible')
ImportError: MagickWand shared library not found or incompatible

On Fri, Aug 24, 2012 at 7:06 PM, Hong Minhee notifications@github.comwrote:

@swgreen https://github.com/swgreen Can you insert import traceback;
traceback.print_exc() between 265–266 and then paste the printed
traceback here?


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-8017315.

@mlindgren

This comment has been minimized.

Contributor

mlindgren commented Sep 4, 2012

I had this same issue, and setting my $MAGICK_HOME to /opt/local fixed it.

@litmisty

This comment has been minimized.

litmisty commented Dec 3, 2012

I'm using OSX mountain lion and brew instead of macport.
I had the same issue.

So I tried this.

import os, ctype
libpath = '/usr/local/lib/libMagickWand.dylib'
libwand = ctypes.CDLL(libpath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libMagickWand.dylib, 6): Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /usr/local/lib/libjpeg.8.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
>>> >>> libwand = ctypes.CDLL(libpath)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/usr/local/lib/libMagickWand.dylib, 6): Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /usr/local/lib/libjpeg.8.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

It seems that there is a problem with libjpeg installed by brew.

I replaced the libjpeg link with OSX's libjpeg.

ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /usr/local/lib/libjpeg.dylib

Problem solved.

@yoloseem

This comment has been minimized.

Contributor

yoloseem commented Dec 26, 2012

Same issue here.

(wand)~/works/wand <master>$ brew install imagemagick
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/imagemagick
Already downloaded: /Library/Caches/Homebrew/imagemagick-6.8.0-10.mountainlion.bottle.tar.gz
==> Pouring imagemagick-6.8.0-10.mountainlion.bottle.tar.gz
==> Caveats
Some tools will complain unless the ghostscript fonts are installed to:
  /usr/local/share/ghostscript/fonts
==> Summary
/usr/local/Cellar/imagemagick/6.8.0-10: 1422 files, 45M
(wand)~/works/wand <master>$ MAGICK_HOME=/usr/local/Cellar/imagemagick/6.8.0-10 python -m wand.api
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/khj/works/wand/wand/api.py", line 128, in <module>
    'Try to install:\n  ' + msg)
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
  brew install imagemagick
(wand)~/works/wand <master>$ brew install imagemagick
Error: imagemagick-6.8.0-10 already installed

I am on OS X 10.8.2.

@yoloseem

This comment has been minimized.

Contributor

yoloseem commented Dec 26, 2012

(wand)~/works/web <master>$ ls /usr/local/lib/libMagickWand*
/usr/local/lib/libMagickWand-Q16.7.dylib
/usr/local/lib/libMagickWand-Q16.dylib
/usr/local/lib/libMagickWand-Q16.la

So I did it and solved:

 $ ln -s /usr/local/lib/libMagickWand-Q16.7.dylib /usr/local/lib/libMagickWand.dylib
@grinner

This comment has been minimized.

grinner commented Dec 30, 2012

Certainly part of the issue is as kinjayd stated above is 2 fold:

  1. Setting MAGICK_HOME seems to be a dependency not mentioned in the install instructions and that it should be, based upon api.py as it is currently written, the location of the imagemagick install directory (which for homebrew installed imagemagick is /usr/local/Cellar/imagemagick/6.8.0-10 or /usr/local for the symlinks) since load_library uses it

  2. api.py does not adequately look for libMagickWand.dylib when installed by homebrew at least. The homebrew build only gives you a libMagickWand-Q16.7.dylib and no libMagickWand.dylib, regex or glob search for the start of the file should be good.

@ghost

This comment has been minimized.

ghost commented Jan 30, 2013

It is not necessary to set MAGICK_HOME with homebrew.

Making the symlink from libMagickWand-Q16.7.dylib to libMagickWand.dylib, as noted by kimjayd, solves the problem.

I think this is an issue with ImageMagick, not with wand. There should already be a symlink to the versioned library, and there is not.

@grinner

This comment has been minimized.

grinner commented Jan 30, 2013

As written, api.py references MAGICK_HOME, so it should either be optional or taken care of as I stated in 1 and 2. It's kind of bad form to make creating a symlink a dependency I think.

If I had time I would fix this.

@dahlia

This comment has been minimized.

Collaborator

dahlia commented Jan 31, 2013

Wand can become to try several possible versions if there’s no loadable libMagickWand.{so,dylib}.

@ghost

This comment has been minimized.

ghost commented Jan 31, 2013

api.py references MAGICK_HOME, but my point is that the problem with a homebrew install has nothing to do with MAGICK_HOME. It's already looking in the right place by default, so changing MAGICK_HOME does nothing. As Dahlia noted, the fix is to check for multiple version numbers. The symlink is just a workaround.

@dahlia dahlia closed this in 93a079b Feb 1, 2013

@jokull

This comment has been minimized.

Contributor

jokull commented Feb 1, 2013

Using Wand 0.2.3 I ended up upgrading from Python 2.7.2 to 2.7.3. This resolved my issue. Using Pythonbrew on OS X 10.7.5.

@nofeet

This comment has been minimized.

nofeet commented Mar 13, 2013

kimjayd's symbolic link worked for me (thanks!), but note that there is a typo in the command. It should be:

 $ ln -s /usr/local/lib/libMagickWand-Q16.7.dylib /usr/local/lib/libMagickWand.dylib
@yoloseem

This comment has been minimized.

Contributor

yoloseem commented Mar 17, 2013

@nofeet yap I fixed it. (lobal to local) Thanks.

@devinrhode2

This comment has been minimized.

devinrhode2 commented Mar 28, 2013

+1 on that symlink. Had the issue on a macbook pro OS X 10.7.5

@mbrochh

This comment has been minimized.

mbrochh commented Jul 7, 2013

I ran into this problem as well. Just placing that symlink didn't help. I had to do the following as well:

brew unlink imagemagick
brew uninstall imagemagick
brew install imagemagick

It threw an error:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link imagemagick'

This happens because two symlinks were still in place:

Target /usr/local/bin/convert already exists. You may need to delete it.
Target /usr/local/share/man/man1/convert.1 already exists. You may need to delete it.

So I deleted them and ran brew link imagemagick again.

Now it seems to work.

@Aea

This comment has been minimized.

Aea commented Oct 30, 2014

My homebrew install missed a package:

>>> import os, ctype
>>> libpath = '/usr/local/lib/libMagickWand-6.Q16.2.dylib'
>>> libwand = ctypes.CDLL(libpath)

...
OSError: dlopen(/usr/local/lib/libMagickWand-6.Q16.2.dylib, 6): Library not loaded: /usr/local/lib/liblzma.5.dylib
...

Fixed with brew install xz

@rlam3

This comment has been minimized.

@sp-ivan-ortega

This comment has been minimized.

sp-ivan-ortega commented Jan 19, 2017

I have found a solution.
The problem is:
Wand try to find a file like that: libMagickWand.dylib in /usr/local/lib/
But if you install ImageMagick with Homebrew, the file generated is libMagickWand-6.Q16.dylib
And Wand never find it.
So, you have 2 solutions:

Create a symbol link from libMagickWand-6.Q16.dylib to libMagickWand.dylib
You can install by MacPorts or from binaries testing that they create the file.
I have installed the ImageMagick for The Capitan from:
http://cactuslab.com/assets/installers/ImageMagick-6.9.1-0.pkg.zip
and I declare:
export MAGICK_HOME=/opt/ImageMagick

@ghost

This comment has been minimized.

ghost commented May 9, 2017

Thanks @sp-ivan-ortega ! This works for me.

@ilonaliao

This comment has been minimized.

ilonaliao commented Jun 16, 2017

Thanks @sp-ivan-ortega ! This works for me,too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment