99designs / colorific

Automatic color palette detection
ISC License
700 stars 55 forks source link

Segmentation fault: 11 #3

Closed georgemandis closed 12 years ago

georgemandis commented 12 years ago

I'm getting this message in the terminal:

Segmentation fault: 11

And a window pops up that says:

Python quit unexpectedly while using the _imaging.so plug-in.

This happens anytime I try to use colorific on the command line:

echo test.png | colorific

I'm running OSX Lion 10.7.3, Python 2.7.1. I've tried compiling from the github source, installing via pip and via easy_install...

Anyone else experiencing this issue or something similar?

dhotson commented 12 years ago

I've seen this as well. I think it has something to do with PIL or maybe underlying libraries like libjpeg but I haven't managed to track it down.

richo commented 12 years ago

Can you enable core dumps with

ulimit -c unlimited

Then reproduce the segfault and gist the (sanitised! if necessary) core dump from /cores/core.$pid ?

dhotson commented 12 years ago

This is the coredump backtrace from gdb

#0  0x000000010e3a1a88 in ImagingQuantize ()
#1  0x000000010e38aecf in _quantize ()
#2  0x000000010def6d77 in PyEval_EvalFrameEx ()
#3  0x000000010def9cd8 in PyEval_EvalCodeEx ()
#4  0x000000010def9e6c in PyEval_EvalCode ()
#5  0x000000010def6e0a in PyEval_EvalFrameEx ()
#6  0x000000010def9cd8 in PyEval_EvalCodeEx ()
#7  0x000000010de97abf in PyClassMethod_New ()
#8  0x000000010de76d32 in PyObject_Call ()
#9  0x000000010def75ec in PyEval_EvalFrameEx ()
#10 0x000000010def9cd8 in PyEval_EvalCodeEx ()
#11 0x000000010def9e6c in PyEval_EvalCode ()
#12 0x000000010def6e0a in PyEval_EvalFrameEx ()
#13 0x000000010def9df7 in PyEval_EvalCode ()
#14 0x000000010def6e0a in PyEval_EvalFrameEx ()
#15 0x000000010def9cd8 in PyEval_EvalCodeEx ()
#16 0x000000010def9d4d in PyEval_EvalCode ()
#17 0x000000010df1108f in Py_CompileString ()
#18 0x000000010df1114f in PyRun_FileExFlags ()
#19 0x000000010df122a2 in PyRun_SimpleFileExFlags ()
#20 0x000000010df222af in Py_Main ()
#21 0x000000010de65e88 in ?? ()
chris-ramon commented 12 years ago

i got the same error under mac osx lion: $ echo nasa.png | colorific

Segmentation fault: 11

amir20 commented 12 years ago

Any body find a solution to this?

larsyencken commented 12 years ago

On OS X, I've had success with the Homebrew packaged PIL ("brew install pil"), but not with MacPorts. That's a good option to try.

amir20 commented 12 years ago

I went through great pain to do

brew install python
brew install pil
pip install colorific

And I still gets

$ echo test.png | colorific 
Abort trap: 6

It works on a linux box though. :(

@larsyencken Did you have to do anything else to get this to work? Am I missing some libraries?

larsyencken commented 12 years ago

Ok, this is actually a PIL bug. Here's a recent patch posted to Image-SIG which fixes it: http://mail.python.org/pipermail/image-sig/2012-June/007047.html

Uninstall the version of PIL which you have, then install this fork with the patch applied: https://github.com/larsyencken/Pillow

pip install https://github.com/larsyencken/Pillow/tarball/master

Does that fix things for you on OS X?

amir20 commented 12 years ago

I get the following error:


echo test.png | colorific 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/colorific", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: PIL>=1.1.6

To get there I did pip uninstall pil and pip install https://github.com/larsyencken/Pillow/tarball/master. However, I am still unable to get it to work.

If I uninstall PIL, wouldn't colorific break?

larsyencken commented 12 years ago

Pillow should be a drop-in replacement for PIL, but it won't match the same package name, which is where the above is failing. I've updated the package dependencies.

Can you please try installing this bugfix branch into a virtualenv?

virtualenv env
source env/bin/activate
pip install https://github.com/99designs/colorific/tarball/bugs/3

It will pull in the patched version of Pillow, which seems to fix the problem for me locally. Let me know how you go.

amir20 commented 12 years ago

@larsyencken Yes! It worked. Sorry it took me so long. I had to learn virtualenv and I didn't have time. This helps a lot and I no longer need to ssh to my linux box to play around with this. Do you think this will merged with master sometime soon?

inklesspen commented 12 years ago

I had the same "Abort trap 6" issue, which I was able to solve using these directions. Since Pillow is a better-packaged version of PIL, I think colorific should switch to depending on Pillow. I was going to fork and make that change, but I see it's already been made in one of your branches. What do you think?

larsyencken commented 12 years ago

The patch has been merged upstream, but isn't in a Pillow release yet. I've changed setup.py to pull in the current Pillow master, and put out a new release (v0.2.1) to PyPI. Once a new Pillow release is out, we'll go back to requiring a given Pillow version.

Please re-open if you get this issue with the new, packaged version.