Building a Model with OpenCV

When you add the opencv-python library and import the cv2 module, you might encounter the following error:

Exception: Error in importing module libGL.so.1: cannot open shared object file: No such file or directory

This issue occurs because the base Docker image does not include the necessary dependencies for OpenCV. To resolve this, you need to use a Docker image that supports OpenCV.

  • For CPU instances: public.ecr.aws/w8k8y6b6/qwak-base:0.0.29-cpu-opencv
  • For GPU instances:public.ecr.aws/w8k8y6b6/qwak-base:0.0.14-gpu-opencv

You can update the base image in one of two ways:

  1. Via Command Line

Add the --base-image parameter when building your model:

qwak models build --base-image 'public.ecr.aws/w8k8y6b6/qwak-base:0.0.14-gpu-opencv'
  1. Via YAML Configuration

Update your YAML configuration file with the base image settings. Refer to our Build Configurations page for more details.

build_env:
  docker:
    base_image: public.ecr.aws/w8k8y6b6/qwak-base:0.0.14-gpu-opencv