-1

I have a lambda function and I am using aws_lambda_powertools in it. Lambda function project structure is like below-

source->Folder
   - handler.py
libs
   - aws-lambda-powertools
   - aws-xray-sdk
   - other libs which aws-lambda-powertools need

handler.py
from libs.aws_lambda_powertools import Logger, Tracer

When I run the lambda, it gives me an error "No Module found aws_xray_sdk" even though the module(used by aws-powertools) is there under the libs folder.

Source of Tracer which I am using in my lambda. https://github.com/awslabs/aws-lambda-powertools-python/blob/f5d14e3279276192c6fed0907b84b1dfa23c7b3c/aws_lambda_powertools/tracing/tracer.py

4
  • 1
    Which module not found ? Ca you please post the complete stack ?
    – jossefaz
    Aug 6, 2020 at 17:33
  • Added module name
    – Knot
    Aug 6, 2020 at 17:34
  • Probably your Python path is messed. $ which python
    – razimbres
    Aug 6, 2020 at 17:37
  • Python version 3.6
    – Knot
    Aug 6, 2020 at 17:38

2 Answers 2

0

Sound like Python don't know where to look. An idea is to put __init__.py files in your directories so Python knows those are packages

2
0

Are you defining your LD_LIBRARY_PATH in your lambda environmental variables?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.