1

I'm using Moviepy to make captioned videos on the python Lambda. ImageMagick is a dependency of Moveipy and comes preinstalled on Lambda, which would be great; however, when I try to create a frame using moviepy.TextClip, I get the following error:

MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmpafOCVo.txt' @ error/constitute.c/ReadImage/454.
convert: no images defined `PNG32:/tmp/tmphhE8gT.png' @ error/convert.c/ConvertImageCommand/3046.

This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or.that the path you specified is incorrect: IOError

I googled forever and it looks like the problem is fallout from https://alas.aws.amazon.com/ALAS-2016-699.html. "This update contains an updated /etc/ImageMagick/policy.xml file that disables the EPHEMERAL, HTTPS, HTTP, URL, FTP, MVG, MSL, TEXT, and LABEL coders."

It also says, "if you experience any problems after the update, it may be necessary to manually adjust the policy.xml file to match your requirements." But I can't do that on Lambda.

StackOverflow folks suggest repackaging lambda and uploading it to Lambda yourself (AWS Lambda not working along with the gm module), but a) that's so ugghhhh and b) I'm using Chalice for Lambda (https://github.com/awslabs/chalice) and whenever I add ImageMagick to the vendor folder and try to deploy I get a broken pipe error from Botocore ( botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', error(32, 'Broken pipe'))) and c) it's been over six months since this change was made has anything changed since then?

Anyone got any other ideas?

Community
  • 1
  • 1
Bailey Smith
  • 2,853
  • 4
  • 27
  • 39
  • Is lambda worth the effort? Lambda's goal is to be safe & stable, but your business requirement seems to be hinting to you that this is not the right tool for the job. Perhaps a EC2 + SQS solution might prove to be less "ugghhhh" ;-) – emcconville Feb 22 '17 at 21:30
  • @emcconville Of course it's worth the effort. You can host whole workloads in a serverless manner with Lambda... not just when you want something to be safe and stable. - Bailey: Did moviepy ever work on Lambda for you? I can take a look sometime today. – mbeacom Apr 13 '17 at 11:19
  • @mbeacom I'd love to have another set of eyes on the problem. I can get it to work with some elbow grease, but development and deployment is a pain. I've created a lambda deployment package with all the dependencies I need, including ImageMagick, on an EC2 instance, and I'm forgoing Chalice entirely. I put in a ticket with awslabs about the Chalice issue but I haven't heard back yet https://github.com/awslabs/chalice/issues/246. And I can't find much about the AWS/ImageMagick issue in general. – Bailey Smith Apr 14 '17 at 03:05
  • @BaileySmith Have you considered https://github.com/Miserlou/Zappa ? AWS took a lot of inspiration from Zappa when they made Chalice... Zappa is much further along in development and production-ready. I'd give that a shot. – mbeacom Apr 14 '17 at 17:49
  • Thanks. I'll take a look :) – Bailey Smith Apr 17 '17 at 17:52

0 Answers0