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
adds option to ignore TCL/Tk framework installs on OS X #1768
Conversation
Does Anaconda define IGNORE_OSX_TCLTK_FRAMEWORKS? If not, should we ask them to? Or is there a suitable env var they already define? |
Recipes for conda packages include a simple build.sh (or on windows bld.bat) script, which for trivial python packages simply contain: $PYTHON setup.py install The conda recipe build.sh for Pillow would simply be modified: export IGNORE_OSX_TCLTK_FRAMEWORKS=1
$PYTHON setup.py install I also submitted a post alerting the anaconda mailing list to this pull request, and one of the developers responded on the list that this would be a good improvement. |
How does anaconda deal with the dynamic load at runtime if there are the two different libraries on the system? |
If I install Anaconda to /opt/conda, and I run "conda install tk", it installs its own tk libraries to the /opt/conda prefix. Anaconda is configured to search this location first. |
@ddale Definitely interested in supporting Anaconda but not convinced this is the right approach. How about a |
@aclark4life I like your solution. That would work just fine for Anaconda. |
@ddale Great! If you update your PR then we'll merge (assuming no other concerns from the @python-pillow/pillow-team ) |
I realize now though that I don't completely understand how to change my pull request to make use of a |
If you want to change a PR, just commit and push into your own osx-no-tk-framework branch and this PR'll be automatically updated. |
@ddale Try adding additional commits to your fork, else I can close this one and you can open another PR. |
Looking at this, I'm not actually understanding how the Tcl/Tk actually work on OSX. By the time we get to Line 490 in e9c4ee3
We then later go through around line Line 589 in e9c4ee3
|
@aclark4life what I meant was, I don't understand how |
@ddale I was picturing the |
@wiredfool I also don't understand why, on os x, after having found TCL/TK, when it is finally time to actually configure the extension module, pillow switches gears and searches for frameworks. |
@wiredfool Possibly because symlinks from
@ddale It would not be surprising at all to discover redundancy and/or bad logic in Pillow's |
Right, so there are symlinks from /usr/lib and /usr/include into the OSX frameworks. In the absence of the framework path, these get linked anyway, as /usr/lib is one of the standard locations we look at. If we disable that stanza completely, I still get a valid build on the mac (mavericks):
yields:
And tests pass. The framework builds were added in a commit labeled "make it work" 3b8ae97. It's an ancient @aclark4life commit, so I'm guessing the reasoning was shear hacking to make it work. |
FWIW This PR also resolves the same problem happening when using Homebrew Python 3 (3.5.1), including virtualenvs. (OS X 10.11.4). |
@cjrh I think we're currently pondering use of the |
@aclark4life Yep I saw that. |
Alternative version of this in #1883, using the command line flag. Can someone check that it solves their issues, as I'm not getting the conda install working here. |
Closed in favor of #1883 |
I'd like anyone who's interested in the "Which tk library to use" saga to check out PR #1932 and let me know if it works for you. |
Fixes issue #950. Pillow's setup.py file incorrectly assumes if you are on OS X, you must link with a TCL/TK framework installation. Some OS X python installations (Anaconda, for example) provide their own TCL/TK installation, which results in segfaults when Pillow tries to load _imagingtk (usually observed with a call to PhotoImage). A simple mechanism is needed to instruct Pillow's setup.py file to not use the the TCL/TK Frameworks installations on OS X. This pull request provides an environment variable IGNORE_OSX_TCLTK_FRAMEWORKS which, if defined, allows setup.py to build against non-frameworks installations of TCL/TK.