-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libGL.so.1: cannot open shared object file #6
Comments
@jongsun-nuvi Make sure your Lambda function and all Lambda layers are configured for the same Python runtime version. |
Running into the same issue, and @aldhalaan, I triple-checked that they are configured for the same Python runtime version. Did not fix the issue. |
@jamesshapiro What version of python were you using 3.7 or 3.8? Did you manage to solve this issue? |
@pacarvalho Either 3.8 or 3.6, I'm pretty sure it was 3.8 though. Finally managed to install cv2 as a Lambda layer by following the instructions in the top answer on this StackOverflow post: https://stackoverflow.com/questions/64016819/cant-use-opencv-python-in-aws-lambda I sort of wish that the iandow tutorial were taken down, it was a complete dead-end for me. |
@jamesshapiro Thank you for the link! I believe the issue is with the AmazonLinux version and a change in the version that is installed via FROM amazonlinux:1
WORKDIR /
RUN yum update -y
# Install Python 3.7
RUN yum install gcc openssl-devel wget tar -y
RUN wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
RUN tar -xzvf Python-3.7.9.tgz
WORKDIR /Python-3.7.9
RUN ./configure --enable-optimizations
RUN make install
# Install Python packages
RUN mkdir /packages
RUN echo "opencv-python" >> /packages/requirements.txt
RUN mkdir -p /packages/opencv-python-3.7/python/lib/python3.7/site-packages
RUN pip3.7 install -r /packages/requirements.txt -t /packages/opencv-python-3.7/python/lib/python3.7/site-packages |
@pacarvalho I've tried the above with |
@nielswart I recommend following Marcin's advice here: https://stackoverflow.com/questions/64016819/cant-use-opencv-python-in-aws-lambda . I found the instructions in this repo completely useless. |
Thanks @jamesshapiro I'm giving that a try!! |
I'd like to give an update on what I did to work around this issue: At first I updated the Dockerfile in this repository to also include the steps outlined in https://stackoverflow.com/questions/64016819/cant-use-opencv-python-in-aws-lambda. When running with While searching for a solution I realised that this whole approach is backwards and that using the I thus got rid of the layer and build my lambda with the |
You should consider making a StackOverflow Q&A post about this for visibility. I'm sure others building with SAM would find it helpful. |
in long long long long time i find it, and finally work for me, Thanks! |
there is import error when I run 'import cv2'
{
"errorMessage": "Unable to import module 'lambda_function': libGL.so.1: cannot open shared object file: No such file or directory",
"errorType": "Runtime.ImportModuleError"
}
START RequestId: fa84da1a-ffa1-46ac-80e1-da354fb38d2b Version: $LATEST
[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': libGL.so.1: cannot open shared object file: No such file or directoryEND RequestId: fa84da1a-ffa1-46ac-80e1-da354fb38d2b
REPORT RequestId: fa84da1a-ffa1-46ac-80e1-da354fb38d2b Duration: 1.74 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 60 MB Init Duration: 168.43 ms
The text was updated successfully, but these errors were encountered: