Closed Bug 582759 Opened 14 years ago Closed 14 years ago

Need jpeg support for PIL on hudson

Categories

(mozilla.org Graveyard :: Server Operations, task)

All
Other
task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: paulc, Assigned: jabba)

Details

We've added image upload with thumbnail support and need the library for jpeg support to be installed on Hudson.

James mentioned it's called libjpeg.

Cc'ing Dave: I hear you can help ;)
write a test so I can verify that this is working and I can install it.
(In reply to comment #1)
> write a test so I can verify that this is working and I can install it.
Test is already checked in, under apps/questions/tests/test_templates.py
It's called test_answer_upload
I meant, can you give me a one liner that I can run from the commandline to test that this works?

from PIL import Image; im = Image(); im.save("foo.jpg");

maybe that will work I assume the middle line is wrong.
Unfortunately, I can install PIL, but I can't get it to necessarily be the PIL for 2.6, it's the PIL for2.4.  However this was able to run without problem:

Image.new('RGB', (32, 32)).save("foo.jpg")

So my guess is that it'll just work...
How about this one:

from PIL import Image; from StringIO import StringIO; io = StringIO(); im = Image.open('/path/to/image.jpg'); im.save(io, 'JPEG');
What's the action for IT? Just install libjpeg on the box?
Assignee: server-ops → jdow
libjpeg and libjpeg-devel are already installed on sm-hudson01
I think PIL is not built to include support for them then. Does the one-liner in comment 5 work?
Looks like everything is good here. Waiting to make sure the build passes and Paul will close or update this bug as necessary.
Looks like the build didn't pass and I'm not sure why.
(In reply to comment #10)
> Looks like the build didn't pass and I'm not sure why.

If you'd linked to the failed build, I could have poked around :) Since I don't know what failed, I'll wait till one of you get back with more info.
Here's one failed build:
https://hudson.mozilla.org/job/support.mozilla.com/227/

The failing test is the same as in comment 2.
Paul,

This is what I see :

FAIL: Posting answer attaches an existing uploaded image to the answer.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/hudson/jobs/support.mozilla.com/workspace/../workspace/apps/questions/tests/test_templates.py", line 63, in test_answer_upload
    eq_(1, new_answer.images.count())
  File "/var/lib/hudson/jobs/support.mozilla.com/workspace/venv/lib/python2.6/site-packages/nose/tools.py", line 31, in eq_
    assert a == b, msg or "%r != %r" % (a, b)
AssertionError: 1 != 0


From https://hudson.mozilla.org/job/support.mozilla.com/227/console

Does that help?
Shyam,

Yes, I saw this too in the console output. Unfortunately, that doesn't help diagnose _why_ the count is 0, though I suspect that the problem lies in apps/upload/tasks.py -- the |_create_thumbnail| function. Justin was able to run the code in comment 5, though, which is similar.

Is it possible that Hudson is importing PIL somehow without libjpeg support?

Here are some things to try:

1.
** enter the django shell with |python manage.py shell| while in the virtualenv, and paste this code:
from upload.tasks import _create_thumbnail
_create_thumbnail('apps/upload/tests/media/test.jpg')


2. if that shows no errors, I have another idea:
** check out this revision: c8b03ff51658ca9328574e1d012c6cb1a26241ec
(link: http://github.com/jsocol/kitsune/commit/c8b03ff51658ca9328574e1d012c6cb1a26241ec)
** comment out line 21 from |apps/uploads/utils.py|:
http://github.com/jsocol/kitsune/blob/c8b03ff51658ca9328574e1d012c6cb1a26241ec/apps/upload/utils.py#L21
** run the entire testsuite and see if there are any failures.


Let me know if you have trouble figuring all that out :)
Okay. Update: Dave helped try 1. above, and the output contained "IOError: decoder jpeg not available".

I imagine Hudson is similar to stage, and it looks like stage works (i.e. I can see a thumbnail here: https://support-stage.mozilla.com/media/uploads/images/thumbnails/Screen_shot_2010-06-08_at_3.28.16_PM_2.png)


Shyam: I think you installed this on stage? Whatever you did there, please document it so we can do it on production as well (hopefully you used an RPM?)

As for hudson, I believe PIL needs to be rebuilt after installing libjpeg. IIRC, Justin ran the code in comment 5 from the python shell -- BUT it looks like the PIL from the virtualenv does _not_ have libjpeg support. So we need the PIL from the virtualenv to be rebuilt.
Running pip install PIL==1.1.7 from the virtualenv solved the problem. libjpeg is now working in the virtualenv.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
S'all good. Hudson passed the test.
Status: RESOLVED → VERIFIED
...

FYI, I just made a checkin to mozilla-central,
that incorrectly pointed to this bug number.
I apologize.

http://hg.mozilla.org/mozilla-central/rev/4e66b4cb5e3a
really belongs to ==>  bug 582579
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.