dockerfileapple-m1openvino

"No matching distribution found for openvino" error after upgrading pip and using env


Problem

I encounter an error when building dockerfile:

#8 10.13 ERROR: Could not find a version that satisfies the requirement openvino>=2022.1.0 (from versions: none)
#8 10.13 ERROR: No matching distribution found for openvino>=2022.1.0
------
executor failed running [/bin/bash -l -c python3.9 -m venv openvino_env &&     source openvino_env/bin/activate &&     python3.9 -m pip install --upgrade pip &&     pip3.9 install -r requirements.txt -t ./python]: exit code: 1

What I tried:

Past posts generally suggested two solutions: 1) upgrade pip, and 2) install in virtual environment. I have tried both but still no luck.

My laptop is Macbook M1, not sure if it is related. I have configured the requirements.txt file as below.

Source code

My Dockerfile:

FROM python:3.9.9-bullseye

RUN apt-get update && \
    apt-get install -y \
    libgl1 libglib2.0-0 zip virtualenv


# Install dependencies
COPY ./requirements.txt .
SHELL ["/bin/bash", "-l", "-c"]
RUN python3.9 -m venv openvino_env && \
    source openvino_env/bin/activate && \
    python3.9 -m pip install --upgrade pip && \
    pip3.9 install -r requirements.txt -t ./python

# Zip it up for deployment.
RUN zip -r layer.zip ./python/
ENTRYPOINT ["/bin/bash", "-l"]

Requirements.txt:

openvino>=2022.1.0; platform_system != "Darwin" or platform_machine != 'arm64'
openvino-arm; platform_system == "Darwin" and platform.machine == 'arm64'

build_docker.sh

# Generates a base layer for the Lambda functions.

# Remove the container first (if it exists).
docker rm layer-container

# Build the base layer.
docker build -t base-layer .

# Rename it to layer-container.
docker run --name layer-container base-layer

# Copy the generated zip artifact so our CDK can use it.
docker cp layer-container:layer.zip . && echo "Created layer.zip with updated base layer."

Solution

  • For Macbook M1, use the command below:

    pip install openvino-arm