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
ImageTk.PhotoImage from PIL leads to segfault #2471
Comments
Conda? ✓ I strongly suspect this issue may be due to the "double framework" problem, i.e. Python's tkinter binary module is linked to the Tcl inside the conda distribution, while Pillow's http://stackoverflow.com/a/37222391/170656 Does the |
Thanks, also assume this is the right direction ...
So I did: |
@MarquitoForrest Your original is Tcl 8.4, so your replacement must also be 8.4. What I mean, is that you need to do:
And remember, you have to do one of those for I'd suggest just copy whatever you see in the |
This is a known issue, here: ContinuumIO/anaconda-issues#188 |
Thanks for pointing me in the right direction, but I am not knowledgeable enough to follow. What I know:
What I think I understand so far is:
Then again I do know:
Not being an expert, I assume it can generally be considered a mistake to compile the pil package in that way. Maybe the thought was, that compiling against the "framework tcl" would avoid that everyone who wants to use pil, has to install the tk package. But this seems the wrong compromise considering the bandwidth and storage we have these days. So I figure, that the pil package needs to be changed so it is compiled against libtcl8.5, because this is the version that gets installed in a python2.7 environment at the moment. I could attempt a workaround by trying to compile tcl myself in order to get the libtcl8.4.so file on my system but I would not know what I have to take care of that it turns out right. In some way it must differ obviously from the "framework libtcl". THANKS everyOne |
@MarquitoForrest Your understanding is exactly right. What I said in that StackOverflow post is a temporary workaround. The correct solution will be for Pillow to be linked to Tcl and Tk in exactly the same way as Python's own I saw now that I made an error in the StackOverflow answer I made. I have now fixed that mistake, perhaps try reading through it again to see if it makes more sense? I'll try to explain a bit more, to perhaps help you get a bit further. The
This is where the support for Tkinter in Pillow comes from. Unfortunately for us, when this was compiled it was linked to a framework version of Tcl and Tk. On OS X, the linking path is often saved in the final binary. To see what these paths are, you can use
(Assuming you're in that folder). So what you see will be framework paths. This doesn't work because in the conda env, Tkinter itself was not linked to a framework, but rather, the Tcl and Tk binaries inside the conda env itself. You can see that also with
With Python 3, the name of the binary includes the Python version, so it may look something like So, one way to fix the issue, is to simply change the linking path directly inside the Pillow binary. For this, you can use a tool called |
@cjrh For now I switched "back" to python 3.5 which I abandoned for this short period because first I thought openCV was not available for 3.5 yet but now I found it on another channel. |
Aha, now I understand your dilemma. |
@cjrh Can I revive this? I'm having the same issue, but I'm still getting errors after following this thread. When I do
Which looks correct. However, when run my Python code again, I get the following error:
|
@gdavtor What do you see for |
I have:
|
@gdavtor Your Pillow is linked to |
The Pillow team is aware of these problems, see: python-pillow/Pillow#1883 |
Thanks! I'm not sure I understand what the fix is. Are these recommending that I run setup.py with a |
@gdavtor I'm also not sure! I haven't had time to look into this more. I just wanted to say that they are working on it. Hopefully when the next release comes out everything will "just work". In the meantime you can probably get things working by using a stock Python and not Anaconda. Or, you can build Pillow yourself and link to the correct Tcl libs manually. |
Not really a conda issue. Going to close. Feel free to keep discussing. |
Hi there, thank you for your contribution to Conda! This issue has been automatically locked since it has not had recent activity after it was closed. Please open a new issue if needed. |
I would like to show a webcam image in a TKinter window.
I did conda install opencv pil into a python 2.7 env.
import numpy
import Tkinter as tk
import cv2
from PIL import Image, ImageTk
to get the image I do:
cam = cv2.VideoCapture(0)
ret_val, frame = cam.read()
cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
img = Image.fromarray(cv2image)
imgtk = ImageTk.PhotoImage(image=img)
the last command kills the interpreter:
Segmentation fault: 11
I am on OS X 10.11 btw.
Thanks!
The text was updated successfully, but these errors were encountered: