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

Time:04-06

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

CodePudding user response:

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
  • Related