简体   繁体   中英

aws eb opencv-python "web: from .cv2 import"

in aws-eb I am deployed an application -django- and there was no error on that process. Health is green and OK but page is giving Internal Server Error . so I checked the logs and saw the below error.

... web: from .cv2 import  
... web: ImportError: libGL.so.1: cannot open shared object file: No such file or directory

while installing requirements.txt on deployment process opencv must be installed. because it includes opencv-python==4.5.5.64 so I not quite sure what is the above error pointing at.

and helpers.py this is how I am import it.

import requests
import cv2

libGL.so is installed with the package libgl1, pip3 install opencv-python is not sufficient here.

Connect the aws via ssh and run;

apt-get update && apt-get install libgl1 

Or even better, consider using docker containers for the project and add the installation commands to the Dockerfile.

Also, as https://stackoverflow.com/a/66473309/12416058 suggests, Package python3-opencv includes all system dependencies of OpenCV. so installing it may prevent further errors.

To install python3-opencv;

apt-get update && apt-get install -y python3-opencv
pip install -r requirements.txt

To install in Dockerfile:

RUN apt-get update && apt-get install -y python3-opencv
RUN pip install -r requirements.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM