Skip to content

Commit

Permalink
Add venv to ubuntu20 to mitigate python version mixup
Browse files Browse the repository at this point in the history
  • Loading branch information
culhatsker committed Nov 12, 2024
1 parent 9c1021e commit 4340695
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion templates/ubuntu20/common/base.dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ 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++ \
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
7 changes: 4 additions & 3 deletions templates/ubuntu20/python/python39.dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# setup Python
ENV PYTHON_VER python3.9

RUN ${PYTHON_VER} -m pip install --upgrade pip
ENV VIRTUAL_ENV=/opt/venv
RUN python3.9 -m venv $VIRTUAL_ENV
ENV PATH=$VIRTUAL_ENV/bin:$PATH
RUN python3 --version

0 comments on commit 4340695

Please sign in to comment.