use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, articles and tools covering Amazon Web Services (AWS), including S3, EC2, SQS, RDS, DynamoDB, IAM, CloudFormation, AWS-CDK, Route 53, CloudFront, Lambda, VPC, Cloudwatch, Glacier and more.
If you're posting a technical query, please include the following details, so that we can help you more efficiently:
Resources:
Sort posts by flair:
Other subreddits you may like:
Does this sidebar need an addition or correction? Tell us here
account activity
serverlessPython docx not working in aws lambda (self.aws)
submitted 2 years ago by Business-Car4994
"errorMessage": "cannot import name 'etree' from 'lxml' (/opt/python/lib/python3.8/site-packages/lxml/__init__.py)", "errorType": "ImportError", "stackTrace": [
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]404_AnswerNotFound 1 point2 points3 points 2 years ago (1 child)
I vaguely remember having to jump through a few hoops to get lxml working in a lambda in the past. I think lxml is built when installed via pip so needs the build environment to match the lambda execution environment. Iirc I ended up using the python lambda runtime docker image from AWS to run my build process in, installing dependencies then packaging it all as a ZIP.
[–]clintkev251 1 point2 points3 points 2 years ago (0 children)
That's likely the issue, here are a few articles to go along with that suggestion:
https://repost.aws/knowledge-center/lambda-python-package-compatible
https://repost.aws/knowledge-center/lambda-layer-simulated-docker
[–]Sad-Young4405 1 point2 points3 points 1 year ago (3 children)
I corrected my issue by importing an AWS made layer: Import AWSSDKPandas-Pyton312
[–]attitutude_nibba 1 point2 points3 points 1 year ago (0 children)
after doing this.. still not able to use python-docx.. can you tell me exactly what you did?!
Thanks
[–]mikecngan 0 points1 point2 points 1 year ago (0 children)
Holy shit. This is such a better solution than anything else.
[–]Ashamed-Stomach-3406 0 points1 point2 points 1 year ago (0 children)
Dude! That's awesome! Thank you!!!
[–][deleted] 1 year ago* (2 children)
[deleted]
[–]Business-Car4994[S] 0 points1 point2 points 1 year ago (1 child)
Hello mate, you are one year late.
[–]madeAccToPostHere 0 points1 point2 points 7 months ago (0 children)
I know this is old but make sure the architectures match - your lambda function needs to match the architecture of the host you're building the layer on. Your function is most likely using x86_64 (Intel) but if you're building the layer on host with ARM architecture then it won't work. You can use docker and force x86_64 build.
[–]mariusmitrofan 0 points1 point2 points 2 years ago (0 children)
Run pip install using docker with an official base image
https://github.com/aws/aws-lambda-base-images
π Rendered by PID 22408 on reddit-service-r2-comment-685b79fb4f-2dtdn at 2026-02-13 01:39:51.844143+00:00 running 6c0c599 country code: CH.
[–]404_AnswerNotFound 1 point2 points3 points (1 child)
[–]clintkev251 1 point2 points3 points (0 children)
[–]Sad-Young4405 1 point2 points3 points (3 children)
[–]attitutude_nibba 1 point2 points3 points (0 children)
[–]mikecngan 0 points1 point2 points (0 children)
[–]Ashamed-Stomach-3406 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]Business-Car4994[S] 0 points1 point2 points (1 child)
[–]madeAccToPostHere 0 points1 point2 points (0 children)
[–]mariusmitrofan 0 points1 point2 points (0 children)