Skip to content

Commit

Permalink
Fix Ubuntu 20 Image build (#315)
Browse files Browse the repository at this point in the history
* fix ubuntu20 for python39

* Add venv to ubuntu20 to mitigate python version mixup
  • Loading branch information
culhatsker authored Nov 14, 2024
1 parent e4d20ee commit 1d59f29
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
12 changes: 8 additions & 4 deletions templates/ubuntu20/common/base.dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SHELL ["/bin/bash", "-xo", "pipefail", "-c"]
RUN apt-get update; \
apt-get install -y --no-install-recommends \
git \
python3-dev \
python3.9-dev \
python3-pip \
build-essential \
cmake \
Expand Down Expand Up @@ -187,17 +187,21 @@ ARG INSTALL_SOURCES="no"
ARG DEPS="tzdata \
curl"
{% if 'runtime' == distribution %}
ARG LGPL_DEPS=""
ARG LGPL_DEPS="python3.9-venv python3-pip"
ARG INSTALL_PACKAGES="-c=python -c=core"
{% elif 'dev' == distribution or 'dev_no_samples' == distribution %}
ARG LGPL_DEPS="g++ \
gcc \
libc6-dev"
libc6-dev \
python3.9-venv \
python3-pip"
ARG INSTALL_PACKAGES="-c=python -c=core -c=dev"
{% else %}
ARG LGPL_DEPS="g++ \
gcc \
libc6-dev"
libc6-dev \
python3.9-venv \
python3-pip"
ARG INSTALL_PACKAGES="-c=python"
{% endif %}

Expand Down
18 changes: 9 additions & 9 deletions templates/ubuntu20/dist/dev.dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ ARG OPENVINO_WHEELS_URL
# hadolint ignore=SC2102
RUN apt-get update && apt-get install -y --no-install-recommends cmake make git && rm -rf /var/lib/apt/lists/* && \
if [ -z "$OPENVINO_WHEELS_URL" ]; then \
${PYTHON_VER} -m pip install --no-cache-dir openvino=="${OPENVINO_WHEELS_VERSION}" && \
${PYTHON_VER} -m pip install --no-cache-dir openvino-tokenizers=="${OPENVINO_WHEELS_VERSION}" && \
${PYTHON_VER} -m pip install --no-cache-dir openvino-genai=="${OPENVINO_WHEELS_VERSION}" && \
${PYTHON_VER} -m pip install --no-cache-dir openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="${OPENVINO_WHEELS_VERSION}" --extra-index-url https://download.pytorch.org/whl/cpu; \
python3 -m pip install --no-cache-dir openvino=="${OPENVINO_WHEELS_VERSION}" && \
python3 -m pip install --no-cache-dir openvino-tokenizers=="${OPENVINO_WHEELS_VERSION}" && \
python3 -m pip install --no-cache-dir openvino-genai=="${OPENVINO_WHEELS_VERSION}" && \
python3 -m pip install --no-cache-dir openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="${OPENVINO_WHEELS_VERSION}" --extra-index-url https://download.pytorch.org/whl/cpu; \
else \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino-tokenizers=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino-genai=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" --extra-index-url https://download.pytorch.org/whl/cpu; \
python3 -m pip install --no-cache-dir --pre openvino=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
python3 -m pip install --no-cache-dir --pre openvino-tokenizers=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
python3 -m pip install --no-cache-dir --pre openvino-genai=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
python3 -m pip install --no-cache-dir --pre openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="${OPENVINO_WHEELS_VERSION}" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" --extra-index-url https://download.pytorch.org/whl/cpu; \
fi

WORKDIR ${INTEL_OPENVINO_DIR}/licensing
Expand All @@ -37,6 +37,6 @@ RUN ./build_samples.sh -b /tmp/build -i ${INTEL_OPENVINO_DIR}/samples/cpp/sample
# hadolint ignore=DL3013
RUN git clone https://github.com/openvinotoolkit/open_model_zoo && \
sed -i '/opencv-python/d' open_model_zoo/demos/common/python/requirements.txt && \
pip3 --no-cache-dir install open_model_zoo/demos/common/python/ && \
python3 -m pip --no-cache-dir install open_model_zoo/demos/common/python/ && \
rm -Rf open_model_zoo && \
python3 -c "from model_zoo import model_api"
10 changes: 5 additions & 5 deletions templates/ubuntu20/dist/dev_no_samples.dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ WORKDIR ${INTEL_OPENVINO_DIR}
ARG OPENVINO_WHEELS_VERSION={{ product_version }}
ARG OPENVINO_WHEELS_URL
# hadolint ignore=SC2102
RUN ${PYTHON_VER} -m pip install --no-cache-dir cmake && \
RUN python3 -m pip install --no-cache-dir cmake && \
if [ -z "$OPENVINO_WHEELS_URL" ]; then \
${PYTHON_VER} -m pip install --no-cache-dir openvino=="$OPENVINO_WHEELS_VERSION" && \
${PYTHON_VER} -m pip install --no-cache-dir openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="$OPENVINO_WHEELS_VERSION" ; \
python3 -m pip install --no-cache-dir openvino=="$OPENVINO_WHEELS_VERSION" && \
python3 -m pip install --no-cache-dir openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="$OPENVINO_WHEELS_VERSION" ; \
else \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino=="$OPENVINO_WHEELS_VERSION" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
${PYTHON_VER} -m pip install --no-cache-dir --pre openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="$OPENVINO_WHEELS_VERSION" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" ; \
python3 -m pip install --no-cache-dir --pre openvino=="$OPENVINO_WHEELS_VERSION" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" && \
python3 -m pip install --no-cache-dir --pre openvino_dev[caffe,kaldi,mxnet,onnx,pytorch,tensorflow2]=="$OPENVINO_WHEELS_VERSION" --trusted-host=* --find-links "$OPENVINO_WHEELS_URL" ; \
fi

WORKDIR ${INTEL_OPENVINO_DIR}/licensing
Expand Down
2 changes: 1 addition & 1 deletion templates/ubuntu20/dist/runtime.dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Install OpenVINO python API dependency
RUN ${PYTHON_VER} -m pip install --no-cache-dir numpy==1.24.4
RUN python3 -m pip install --no-cache-dir numpy==1.24.4

WORKDIR ${INTEL_OPENVINO_DIR}/licensing
# Please use `third-party-programs-docker-runtime.txt` short path to 3d party file if you use the Dockerfile directly from docker_ci/dockerfiles repo folder
Expand Down
4 changes: 0 additions & 4 deletions templates/ubuntu20/python/python38.dockerfile.j2

This file was deleted.

5 changes: 5 additions & 0 deletions templates/ubuntu20/python/python39.dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# setup Python
ENV VIRTUAL_ENV=/opt/venv
RUN python3.9 -m venv $VIRTUAL_ENV
ENV PATH=$VIRTUAL_ENV/bin:$PATH
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools

0 comments on commit 1d59f29

Please sign in to comment.