deep-learning-containers icon indicating copy to clipboard operation
deep-learning-containers copied to clipboard

[bug] OpenCV is not installed properly for Inference container

Open maxim-gapchenko opened this issue 3 years ago • 1 comments

Checklist

  • [x] I've prepended issue tag with type of change: [bug]
  • [ ] (If applicable) I've attached the script to reproduce the bug
  • [x] (If applicable) I've documented below the DLC image/dockerfile this relates to
  • [ ] (If applicable) I've documented below the tests I've run on the DLC image
  • [x] I'm using an existing DLC image listed here: https://docs.aws.amazon.com/deep-learning-containers/latest/devguide/deep-learning-containers-images.html
  • [ ] I've built my own container based off DLC (and I've attached the code used to build my own image)

Concise Description: Need to use opencv with pytorch inference. By default when import cv2 got ModuleNotFoundError: No module named 'cv2'

If add opencv-python-headless==4.2.0.34 to the requirements.txt, got following error: ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory (If do not specify opencv version, there is another error)

DLC image/dockerfile: 301217895009.dkr.ecr.us-west-2.amazonaws.com/sagemaker-neo-pytorch:1.5.1-inf-py3

Current behavior:

Expected behavior:

Additional context:

maxim-gapchenko avatar Apr 13 '22 14:04 maxim-gapchenko

Tried to extend this docker container, but got access denied error. Looks like this container has incorrect policy.

Here is code to reproduce the error. aws ecr get-login-password --region "us-west-2" | docker login --username AWS --password-stdin "301217895009.dkr.ecr.us-west-2.amazonaws.com" docker pull "301217895009.dkr.ecr.us-west-2.amazonaws.com/sagemaker-neo-pytorch:1.5.1-inf-py3"

code works without any problems for another sample container: 520713654638.dkr.ecr.us-west-2.amazonaws.com/sagemaker-pytorch:0.4.0-cpu-py3

maxim-gapchenko avatar Apr 15 '22 10:04 maxim-gapchenko