Why am I getting this error when trying to run openCV/pillow on container?

  docker, libpng, opencv, python, python-imaging-library

I have a program that I am able to execute locally but not in a docker container. When running

image=cv2.imread(input_file_path)

I get:

libpng warning: Duplicate iCCP chunk

and the program terminates in a few. If I try to install Pillow 6.1.0 (which is the same version I have locally) I get this error when trying to do docker build:

  The headers or library files could not be found for jpeg,
  a required dependency when compiling Pillow from source.
  
  Please see the install instructions at:
     https://pillow.readthedocs.io/en/latest/installation.html

But haven’t been able to address the issue.

Requirements.txt:

boto3==1.14.46
imutils==0.5.4
opencv-python==4.5.1.48
urllib3==1.25.10

Dockerfile:

FROM continuumio/miniconda3

COPY . /
WORKDIR /
RUN pip install --upgrade pip setuptools wheel
ADD requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
RUN pip install Pillow
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y
ENTRYPOINT ["python", "main.py"]

Source: Docker Questions

LEAVE A COMMENT