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

pillow tk extension problem on os x #188

Closed
ddale opened this issue Oct 8, 2014 · 10 comments · Fixed by conda-archive/conda-recipes#229
Closed

pillow tk extension problem on os x #188

ddale opened this issue Oct 8, 2014 · 10 comments · Fixed by conda-archive/conda-recipes#229
Assignees

Comments

@ddale
Copy link

ddale commented Oct 8, 2014

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
Copy link
Author

ddale commented Dec 25, 2014

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
Copy link

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
Copy link

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
Copy link

goretkin commented Feb 9, 2016

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

@goretkin
Copy link

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

@sametz
Copy link

sametz commented Apr 19, 2016

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

@drabastomek
Copy link

Same deal... Can you fix this?

@stevengj
Copy link

stevengj commented Jul 29, 2016

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 (JuliaPy/PyPlot.jl#164).

@stevengj
Copy link

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
Copy link

goretkin commented Apr 6, 2017

This is the fix that worked for me: python-pillow/Pillow#950 (comment)

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

Successfully merging a pull request may close this issue.

9 participants