ContinuumIO / anaconda-issues

Anaconda issue tracking
648 stars 222 forks source link

pillow tk extension problem on os x #188

Closed ddale closed 9 years ago

ddale commented 10 years ago

Pillow's default setup.py builds an _imagingtk extension that is not compatible with the anaconda environment, because it links with the system tk framework:

WARNING: Non standard TIFF. Rows per strip TAG missing
WARNING: Non standard TIFF. Strip byte counts TAG missing
objc[5020]: Class TKApplication is implemented in both /anaconda/envs/hedm/lib/python2.7/lib-dynload/../../libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[5020]: Class TKMenu is implemented in both /anaconda/envs/hedm/lib/python2.7/lib-dynload/../../libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[5020]: Class TKContentView is implemented in both /anaconda/envs/hedm/lib/python2.7/lib-dynload/../../libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[5020]: Class TKWindow is implemented in both /anaconda/envs/hedm/lib/python2.7/lib-dynload/../../libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
Segmentation fault: 11

This simple patch allows pillow to find the tcl/tk provided by anaconda and fixes the problem:

diff --git setup.py setup.py
index 2d8cafa..f95c871 100644
--- setup.py
+++ setup.py
@@ -575,7 +575,7 @@ class pil_build_ext(build_ext):
             exts.append(Extension(
                 "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))

-        if sys.platform == "darwin":
+        if sys.platform == "":
             # locate Tcl/Tk frameworks
             frameworks = []
             framework_roots = [

(Please also note issue #185)

ddale commented 9 years ago

Sorry for the apparent mess of commits. There was some confusion, branching off my fork's master rather than conda's. Apparently github is caching info about commits that don't exist anymore.

slobodan-ilic commented 9 years ago

Hi, I'm experiencing the same error message on OSX. I installed the latest official anaconda, created conda environment and installed pillow in it, with "conda install pillow". The version of the installed pillow is 2.7.0. Is there any way I could get around this issue?

UPDATE: I managed to get around this issue by building the 2.6.1 version, uploading it to my binstar, and then installing that specific version with "conda install pillow=2.6.1". Anyways, this thread was very helpful. Thanks very much.

asampat3090 commented 8 years ago

I have the same issue but I'm not too familiar with conda but when I use the command conda install pillow=2.6.1 there are no packages found that match that. Is there a way to manually fix this setup.py and if so, how do I actually install it? As of now I installed pillow using conda install pillow and this gave me pillow 2.8.2 and I have the same issue. Specifically,

objc[87311]: Class TKApplication is implemented in both /Users/anandsampat/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[87311]: Class TKMenu is implemented in both /Users/anandsampat/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[87311]: Class TKContentView is implemented in both /Users/anandsampat/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
objc[87311]: Class TKWindow is implemented in both /Users/anandsampat/anaconda/lib/libtk8.5.dylib and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined.
[1]    87311 segmentation fault  python cleanup.py
goretkin commented 8 years ago

I'm experiencing this issue. conda install pillow is pulling pillow: 3.1.1-py35_0 defaults, which is producing the same error.

goretkin commented 8 years ago

Could this issue be re-opened, or should I make a new issue?

sametz commented 8 years ago

I am having the same issue. Python 3.5.1, Anaconda 4.0.5, OS X.

drabastomek commented 8 years ago

Same deal... Can you fix this?

stevengj commented 8 years ago

This is not just an issue for pillow; we're seeing the same issue in using a miniconda Matplotlib with the Tk backend on OS X from Julia (stevengj/PyPlot.jl#164).

stevengj commented 8 years ago

And the same issue appears for Python matplotlib users with the Tk backend: http://stackoverflow.com/questions/31998271/matplotlib-cant-work-in-os-x-with-error-tkapplication-is-implemented-in-both

A workaround is just to use a different Matplotlib backend, but it would be good to fix the anaconda Tk library conflict.

goretkin commented 7 years ago

This is the fix that worked for me: https://github.com/python-pillow/Pillow/issues/950#issuecomment-292223310