Skip to content
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

Segmentation fault in AWS Lambda call #8

Open
dioh opened this issue Oct 30, 2020 · 2 comments
Open

Segmentation fault in AWS Lambda call #8

dioh opened this issue Oct 30, 2020 · 2 comments

Comments

@dioh
Copy link

dioh commented Oct 30, 2020

When using python-opencv-headless for runtime python 3.8 will throw segmentation fault on invocation. Do you know why is this happening?

Dockerfile:

`FROM amazonlinux

WORKDIR /
RUN yum update -y

Install Python 3.8

RUN yum install gcc openssl-devel bzip2-devel libffi-devel wget tar gzip make -y
RUN wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
RUN tar -xzvf Python-3.7.0.tgz
WORKDIR /Python-3.7.0
RUN ./configure --enable-optimizations
RUN make install

Install Python 3.7

RUN yum install python3 zip -y

Install Python packages

RUN mkdir /packages
RUN echo "opencv-python-headless" >> /packages/requirements.txt
RUN mkdir -p /packages/opencv-python-3.7/python/lib/python3.7/site-packages

RUN mkdir -p /packages/opencv-python-3.8/python/lib/python3.8/site-packages

RUN echo "numpy" >> /packages/requirements.txt
RUN echo "pdf2image" >> /packages/requirements.txt
RUN pip3.7 install pip --upgrade
RUN pip3.7 install -r /packages/requirements.txt -t /packages/opencv-python-3.7/python/lib/python3.7/site-packages

Create zip files for Lambda Layer deployment

WORKDIR /packages/opencv-python-3.7/
RUN zip -r9 /packages/cv2-python37.zip .
WORKDIR /packages/

RUN rm -rf /packages/opencv-python-3.7/

`

@amirhmk
Copy link

amirhmk commented Dec 1, 2020

What's the exact error you're getting? You're just getting a seg fault?

@amirhmk
Copy link

amirhmk commented Dec 3, 2020

Using this package on Serverless helped me streamline this whole process and reduce the package size as well. Would definitely recommend checking it out. Make sure to leave the strip flag to false

Serverless python-requirements plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants