1

Trying to make an import of cv2 in aws lambda. Tried to install it with a layer with an arn from this link: https://github.com/keithrozario/Klayers/blob/master/deployments/python3.8/arns/eu-west-3.csv

But i get an error and have trouble to solve it: "Unable to import module 'lambda_function': libgthread-2.0.so.0: cannot open shared object file: No such file or directory"

My lambda works with python 3.8 also. I also tried python 3.6 and 3.7.

Does anybody have a fonctionnal Klayer arn for opencv ? Or a usefull tutorial to make it.

import json
import cv2 


def lambda_handler(event, context):
    # TODO implement
    
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

2 Answers 2

1

Was searching for an answer and found the solution here: https://github.com/keithrozario/Klayers/issues/115

It requires both the opencv module and libgthread-2.0.so.0 to work.

Go to https://github.com/keithrozario/Klayers again and look for the "libgthread-so" package. Add the libgthread-so package as a new layer and it should work.

Sign up to request clarification or add additional context in comments.

Comments

0

I was also on the same error but as @jen said that you must have libgthread-so to make this work

Add this to your lambda layer

arn:aws:lambda:ap-south-1:770693421928:layer:Klayers-python38-libgthread-so:1

Hope it helps

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.