environments ai ml automl dnn vision gpu - Azure/azureml-assets GitHub Wiki
An environment used by Azure ML AutoML for training models.
Version: 60
OS : Ubuntu20.04 Training Preview OpenMpi : 4.1.0 Python : 3.9
View in Studio: https://ml.azure.com/registries/azureml/environments/ai-ml-automl-dnn-vision-gpu/version/60
Docker image: mcr.microsoft.com/azureml/curated/ai-ml-automl-dnn-vision-gpu:60
FROM mcr.microsoft.com/aifx/acpt/stable-ubuntu2204-cu126-py310-torch280:biweekly.202611.1
# Python 3.11 is required for the patched filelock 4.2.x release line.
RUN conda install -n ptca -c conda-forge -y python=3.11 pip && \
rm -rf /opt/conda/envs/ptca/lib/python3.10 && \
conda clean -a -y
ENV AZUREML_CONDA_ENVIRONMENT_PATH=/azureml-envs/azureml-automl-dnn-vision-gpu
ENV PATH=$AZUREML_CONDA_ENVIRONMENT_PATH/bin:$PATH
COPY --from=mcr.microsoft.com/azureml/mlflow-ubuntu20.04-py38-cpu-inference:20250506.v1 /var/mlflow_resources/ /var/mlflow_resources/
ENV MLFLOW_MODEL_FOLDER="mlflow-model"
# Inference requirements and OS security updates.
COPY --from=mcr.microsoft.com/azureml/o16n-base/python-assets:20250310.v1 /artifacts /var/
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
liblttng-ust1 \
libunwind8 \
libxml++2.6-2v5 \
nginx-light \
psmisc \
rsyslog \
runit \
unzip && \
DEBIAN_FRONTEND=noninteractive apt-get install --reinstall -y \
dotnet-host-8.0 \
dotnet-hostfxr-8.0 \
dotnet-runtime-8.0 \
curl \
libcurl3-gnutls \
libcurl4 \
libgcrypt20 \
libgssapi-krb5-2 \
libk5crypto3 \
libkrb5-3 \
libkrb5support0 \
libnghttp2-14 \
libsqlite3-0 \
liblzma5 \
tar \
wget \
nginx-common \
nginx-light \
libnginx-mod-http-geoip2 \
libnginx-mod-http-echo \
xz-utils && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
cp /var/configuration/rsyslog.conf /etc/rsyslog.conf && \
cp /var/configuration/nginx.conf /etc/nginx/sites-available/app && \
ln -sf /etc/nginx/sites-available/app /etc/nginx/sites-enabled/app && \
rm -f /etc/nginx/sites-enabled/default && \
apt-get autoremove -y
ENV SVDIR=/var/runit
ENV WORKER_TIMEOUT=400
EXPOSE 5001 8883 8888
ENV ENABLE_METADATA=true
# Update pip in base and ptca environments.
# The pip already present in these envs was installed by pip itself, so conda does not
# own its files; overlaying a conda pip on top leaves a mix of two pip trees behind and
# every later pip invocation dies with "ImportError: cannot import name
# 'get_runnable_pip' from 'pip._internal.utils.misc'". Remove the pip package directory
# first so conda lays down a coherent installation. --force-reinstall is required: the
# conda-meta record survives the rm, so a plain "conda install pip" is a no-op and would
# leave the env with no pip module at all.
RUN rm -rf /opt/conda/lib/python*/site-packages/pip \
/opt/conda/lib/python*/site-packages/pip-*.dist-info && \
conda install pip -n base -y --force-reinstall
RUN rm -rf /opt/conda/envs/ptca/lib/python*/site-packages/pip \
/opt/conda/envs/ptca/lib/python*/site-packages/pip-*.dist-info && \
conda install pip -n ptca -y --force-reinstall
# Build the Python 3.11 pmdarima wheel with its legacy build toolchain.
RUN conda create -p /tmp/pmdarima-builder -y -c conda-forge \
python=3.11 pip 'numpy>=1.23.5,<1.24' 'Cython<3' 'setuptools==59.8.0' wheel && \
conda run -p /tmp/pmdarima-builder pip wheel --no-cache-dir --no-deps \
--no-build-isolation --wheel-dir /opt/pmdarima-wheel 'pmdarima==1.8.5' && \
rm -rf /tmp/pmdarima-builder
ENV PIP_FIND_LINKS=/opt/pmdarima-wheel
# Create conda environment
RUN conda create -p $AZUREML_CONDA_ENVIRONMENT_PATH \
python=3.11 \
pip \
numpy~=1.23.5\
pycocotools=2.0.7 \
shap=0.42.1 \
llvmlite=0.41.1 \
scipy=1.10.1 \
setuptools=84.1.0 \
wheel=0.46.2 \
-c conda-forge -c cerebis && \
conda clean -a -y
# Install pip dependencies. azureml-inference-server-http stays on the 1.4.x line
# required by azureml-defaults to avoid resolving newer inference server extras.
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver \
azureml-mlflow==1.62.0.post7 \
azureml-dataset-runtime==1.62.0.post1 \
azureml-telemetry==1.62.0 \
azureml-responsibleai==1.62.0 \
azureml-automl-core==1.62.0.post3 \
azureml-automl-runtime==1.62.0.post1 \
azureml-defaults==1.62.0 \
'azureml-inference-server-http==1.4.1' \
azureml-interpret==1.62.0 \
'azureml-dataprep>=2.24.4' \
'azure-identity>=1.25.1' \
'pillow==12.3.0'
# Install packages with torch packages separately to reduce layer size
RUN pip install --no-cache-dir --use-deprecated=legacy-resolver \
azureml-train-automl-client==1.62.0 \
azureml-train-automl-runtime==1.62.0 \
azureml-automl-dnn-vision==1.62.0.post1
# Vulnerability patches for conda environment
# NOTE: cryptography>=48.0.1 (GHSA-537c-gmf6-5ccf): azureml-mlflow==1.62.0.post2
# constrains cryptography<47.0.0, but no AzureML parent has a patched
# cryptography floor; explicit override is required.
# NOTE: azureml-automl-runtime pins onnx<=1.17.0,>=1.16.1; force-installing onnx>=1.21.0 to fix
# GHSA-cmw6-hcpp-c6jp, GHSA-538c-55jv-c5g9, GHSA-q56x-g2fj-4rj6, GHSA-p433-9wv8-28xj,
# GHSA-3r9x-f23j-gc73, GHSA-hqmj-h5c6-369m. Parent azureml-automl-runtime (1.62.0) cannot
# be upgraded as latest still constrains onnx<=1.17.0.
# NOTE: GitPython>=3.1.55 fixes GHSA-r9mr-m37c-5fr3, GHSA-6p8h-3wgx-97gf,
# GHSA-fjr4-x663-mwxc, and GHSA-94p4-4cq8-9g67. It is installed
# transitively via mlflow-skinny from azureml-mlflow.
# NOTE: msgpack>=1.2.1 fixes GHSA-6v7p-g79w-8964. Stale copies are reported
# from pip vendored metadata, so metadata cleanup below is also required.
# NOTE: starlette>=1.0.1 (GHSA-86qp-5c8j-p5mr): starlette 0.52.1 is installed as a
# transitive dep into the azureml-automl-dnn-vision-gpu conda env. No parent
# release pins the patched floor; explicit override required.
# NOTE: pyarrow==23.0.1 (GHSA-rgxp-2hwp-jwgg / CVE-2026-25087): pyarrow 17.0.0
# is installed transitively via azureml-dataset-runtime in this conda env;
# pin the patched release because newer pyarrow requires NumPy 2, while
# AutoML requires the NumPy 1.23 ABI.
# NOTE: torch>=2.10.0 (GHSA-vgrw-7cvw-pwgx / GHSA-qfhq-4f3w-5fph): installed
# by azureml-automl-dnn-vision/base torch image; explicit override required.
# NOTE: pillow==12.3.0 fixes GHSA-8v84-f9pq-wr9x, GHSA-9hw9-ch79-4vh6,
# GHSA-vjc4-5qp5-m44j, GHSA-pg7v-jwj7-p798, GHSA-45hq-cxwh-f6vc,
# GHSA-phj9-mv4w-65pm, GHSA-62p4-gmf7-7g93, and GHSA-5x94-69rx-g8h2.
# NOTE: sqlparse>=0.6.0 fixes GHSA-f2ff-p2ww-7p4p, GHSA-prg7-hcfm-mfcr,
# GHSA-3496-9g83-7v6x, and GHSA-pwgv-4x5q-6m9f. It is installed transitively
# via mlflow-skinny from azureml-mlflow; no parent release floors the patched
# version, so explicit override is required.
# NOTE: numpy~=1.23.5 is NOT a security floor. It repeats the cap applied to the conda
# env above so that pip sees it while resolving the floors here: onnx pulls
# ml_dtypes, which as of 0.6.0 requires numpy>=2.0.0. Without the cap in this same
# resolve pip silently upgrades numpy to 2.x, leaving the prebuilt pandas wheel
# binary-incompatible so the image fails on import pandas with
# "ValueError: numpy.dtype size changed".
# Upgrade the converter family with ONNX, which no longer exports onnx.mapping.
RUN pip install --no-cache-dir --upgrade \
'numpy~=1.23.5' \
'cryptography>=48.0.1' \
'distributed>=2026.1.0' \
'mlflow-skinny>=2.16.0' \
'bokeh>=3.8.2' \
'GitPython>=3.1.55' \
'msgpack>=1.2.1' \
'pillow==12.3.0' \
'onnx>=1.21.0' \
'skl2onnx==1.20.0' \
'onnxmltools==1.16.0' \
'onnxconverter-common==1.16.0' \
'requests>=2.33.0' \
'idna>=3.15' \
'pyOpenSSL>=26.0.0' \
'wheel>=0.46.2' \
'starlette>=1.0.1' \
'pyarrow==23.0.1' \
'sqlparse>=0.6.0'
# Vulnerability patches for ptca environment
# pip>=26.1 (CVE-2026-6357 / GHSA-jp4c-xjxw-mgf9): pip < 26.1 deferred imports of
# well-known module names until after wheel install, allowing a freshly-installed
# wheel to be imported during the self-update check. ptca env ships pip 26.0.1
# in biweekly.202605.2; pip is its own parent (no upstream package can pull in a
# fixed pip via dependency resolution), so explicit override is required.
# torch>=2.10.0 (GHSA-vgrw-7cvw-pwgx / GHSA-qfhq-4f3w-5fph): ptca env in the
# ACPT base image ships torch 2.8.0+cu126; explicit override required.
# pillow==12.3.0: pinned transitive dep brought in by the ACPT base image;
# fixes GHSA-8v84-f9pq-wr9x, GHSA-9hw9-ch79-4vh6, GHSA-vjc4-5qp5-m44j,
# GHSA-pg7v-jwj7-p798, GHSA-45hq-cxwh-f6vc, GHSA-phj9-mv4w-65pm,
# GHSA-62p4-gmf7-7g93, and GHSA-5x94-69rx-g8h2.
RUN /opt/conda/envs/ptca/bin/pip install --no-cache-dir --upgrade \
'pip>=26.1' \
'aiohttp>=3.14.0' \
'msgpack>=1.2.1' \
'pillow==12.3.0'
# Upgrade Torch and torchvision together so their compiled NMS operators remain compatible.
# CUDA 12.6 has no matching torchaudio build for this stack; remove the inherited copy.
RUN pip uninstall -y torchaudio && \
pip install --no-cache-dir --upgrade \
--index-url https://download.pytorch.org/whl/cu126 \
'torch==2.13.0' 'torchvision==0.28.0' && \
/opt/conda/envs/ptca/bin/pip uninstall -y torchaudio && \
/opt/conda/envs/ptca/bin/pip install --no-cache-dir --upgrade \
--index-url https://download.pytorch.org/whl/cu126 \
'torch==2.13.0' 'torchvision==0.28.0'
# setuptools>=84.1.0 fixes current vulnerabilities in the inherited PTCA environment.
RUN /opt/conda/envs/ptca/bin/pip install --no-cache-dir --force-reinstall --no-deps 'setuptools==84.1.0'
# python-dotenv>=1.2.2 (GHSA-mf9w-mj56-hr94 / CVE-2026-28684): set_key()/unset_key()
# follow symlinks on cross-device .env writes, allowing arbitrary file overwrite.
# python-dotenv 1.2.1 is shipped in the base conda env of the ACPT
# base image as a transitive dep via pydantic-settings (declares python-dotenv>=0.21.0
# with no upper-bound tightening through 2.14.0), so no parent package release pins
# python-dotenv>=1.2.2 — explicit override of /opt/conda is the only fix path until
# the ACPT base image is rebuilt with the patch.
# pip>=26.1 (CVE-2026-6357 / GHSA-jp4c-xjxw-mgf9): pip < 26.1 deferred imports of
# well-known module names until after wheel install, allowing a freshly-installed
# wheel to be imported during the self-update check. The base conda env ships pip 26.0.1
# from the ACPT base image; pip is its own parent (no upstream package can pull in
# a fixed pip via dependency resolution), so explicit override is required.
# urllib3>=2.7.0 (GHSA-qccp-gfcp-xxvc, GHSA-mf9v-mfxr-j63j): urllib3 2.6.3 is shipped
# in the base conda env by the ACPT base image. urllib3 is a root security
# package — its parents (requests pins urllib3>=1.21.1,<3; botocore pins
# urllib3>=1.25.4,<3) do not bound it tightly enough to force 2.7.0, so no parent
# upgrade can pull in the fix. Explicit override required.
# click>=8.3.3 (GHSA-47fr-3ffg-hgmw / CVE-2026-7246): metadata probe of the
# resolved base image found click 8.2.1 in /opt/conda via
# anaconda-cli-base==0.8.2 (`click`) and typer==0.25.1 (`click>=8.2.1`).
# Current published parent metadata still has loose floors only, so no parent
# upgrade can force the patched click version; explicit override is required.
# aiohttp>=3.14.0 (GHSA-hg6j-4rv6-33pg / GHSA-jg22-mg44-37j8): aiohttp 3.13.5 is
# shipped in the base conda env of the ACPT base image. Two CVEs require
# 3.14.0; no parent release pins the patched floor, so explicit override required.
# PyJWT>=2.13.0 (GHSA-993g-76c3-p5m4 / GHSA-jq35-7prp-9v3f): PyJWT 2.12.1 is
# shipped in the base conda env of the ACPT base image; explicit
# override required until the base image is rebuilt with a patched floor.
# py-rattler>=0.24.0 (GHSA-q53q-5r4j-5729): py-rattler 0.23.1 is shipped in the
# base conda env of the ACPT base image; explicit override required
# until the base image is rebuilt with a patched floor.
# cryptography>=48.0.1 (GHSA-537c-gmf6-5ccf): cryptography 46.0.7 is shipped in
# the base conda env of the ACPT base image; explicit override required
# until the base image is rebuilt with a patched floor.
# pillow==12.3.0: pinned transitive dep brought in by the ACPT base image;
# fixes GHSA-8v84-f9pq-wr9x, GHSA-9hw9-ch79-4vh6, GHSA-vjc4-5qp5-m44j,
# GHSA-pg7v-jwj7-p798, GHSA-45hq-cxwh-f6vc, GHSA-phj9-mv4w-65pm,
# GHSA-62p4-gmf7-7g93, and GHSA-5x94-69rx-g8h2.
RUN conda run -n base pip install --no-cache-dir --upgrade \
'python-dotenv>=1.2.2' \
'pip>=26.1' \
'urllib3>=2.7.0' \
'idna>=3.15' \
'click>=8.3.3' \
'aiohttp>=3.14.0' \
'anyio>=4.14.2' \
'PyJWT>=2.13.0' \
'py-rattler>=0.24.0' \
'cryptography>=48.0.1' \
'msgpack>=1.2.1' \
'pillow==12.3.0'
# setuptools>=84.1.0 fixes current vulnerabilities in the inherited base conda environment.
RUN /opt/conda/bin/pip install --no-cache-dir --force-reinstall --no-deps 'setuptools==84.1.0'
RUN rm -rf /opt/conda/pkgs/
RUN set -eux; \
find / -xdev -path '*/pip/_vendor/bom.cdx.json' -type f -delete; \
find /azureml-envs /opt -path '*/_vendor/vendor.txt' -type f -exec \
sed -i -E 's/setuptools==70\.3\.0/setuptools==84.1.0/g; s/msgpack==1\.1\.2/msgpack==1.2.1/g' {} +; \
grep -RIlE 'pkg:pypi/(setuptools@70\.3\.0|msgpack@1\.1\.2)|setuptools==70\.3\.0|msgpack==1\.1\.2' /azureml-envs /opt 2>/dev/null | \
xargs -r sed -i -E 's/pkg:pypi\/setuptools@70\.3\.0/pkg:pypi\/[email protected]/g; s/pkg:pypi\/msgpack@1\.1\.2/pkg:pypi\/[email protected]/g; s/setuptools==70\.3\.0/setuptools==84.1.0/g; s/msgpack==1\.1\.2/msgpack==1.2.1/g'; \
test -z "$(grep -RIlE 'pkg:pypi/(setuptools@70\.3\.0|msgpack@1\.1\.2)|setuptools==70\.3\.0|msgpack==1\.1\.2' /azureml-envs /opt 2>/dev/null | head -n 1)"
# Remove stale conda-meta entries for pip 26.0.x in both base and ptca envs.
# `pip install --upgrade pip` (above) replaces the wheel under site-packages but
# does NOT update conda's package database (conda-meta/pip-*.json), so SCA
# scanners that read conda-meta keep flagging CVE-2026-6357 even though the
# running pip is 26.1.x. Removing the stale json makes scanners pick up the
# pip dist-info from site-packages (which reflects the upgraded version).
RUN rm -f /opt/conda/conda-meta/pip-26.0.*.json \
/opt/conda/envs/ptca/conda-meta/pip-26.0.*.json
ENV LD_LIBRARY_PATH=$AZUREML_CONDA_ENVIRONMENT_PATH/lib:$LD_LIBRARY_PATH
# Refresh packages for the latest Ubuntu security advisories.
RUN set -eux; \
apt-get update; \
security_packages="curl libcurl3-gnutls libcurl3t64-gnutls libcurl4 libcurl4t64 libevent-core-2.1-7 libssl-dev libssl3 libx11-6 libx11-data libx11-xcb1 openssh-client openssh-server openssh-sftp-server openssl"; \
installed_packages=""; \
for package in $security_packages; do \
if dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then \
installed_packages="$installed_packages $package"; \
fi; \
done; \
if [ -n "$installed_packages" ]; then apt-get install -y --only-upgrade $installed_packages; fi; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Reassert newly patched transitive dependencies after all package installs.
RUN /azureml-envs/azureml-automl-dnn-vision-gpu/bin/python -m pip install --no-cache-dir --upgrade 'urllib3>=2.8.0'
# Reassert current vulnerability-report floors in each scanned Python prefix.
RUN $AZUREML_CONDA_ENVIRONMENT_PATH/bin/python -m pip install --no-cache-dir --upgrade \
'filelock>=4.2.1' 'pillow>=13.0.0' 'pyasn1>=0.6.5' \
'setuptools>=84.1.0' 'tornado>=6.6'
RUN /opt/conda/envs/ptca/bin/python -m pip install --no-cache-dir --upgrade \
'filelock>=4.2.1' 'pillow>=13.0.0' 'pyasn1>=0.6.5' 'setuptools>=84.1.0'
RUN /opt/conda/bin/python -m pip install --no-cache-dir --upgrade \
'brotlicffi>=1.2.1.0' 'certifi>=2026.10.19' \
'opentelemetry-api>=1.45.1' 'pillow>=13.0.0' 'pyasn1>=0.6.5' && \
find /azureml-envs /opt/conda -type d \( \
-name 'pillow-12.3.0.dist-info' -o \
-name 'setuptools-83.0.0*' -o \
-name 'setuptools-84.0.0*' \
\) -prune -exec rm -rf {} + && \
find /azureml-envs /opt/conda -path '*/conda-meta/*.json' -type f \( \
-name 'pillow-12.3.0-*.json' -o \
-name 'setuptools-84.0.0-*.json' \
\) -delete && \
rm -rf /opt/conda/lib/python3.14/site-packages/certifi-2024.7.4.dist-info \
/opt/conda/lib/python3.14/site-packages/opentelemetry__api-1.43.0.dist-info \
/opt/conda/lib/python3.14/site-packages/pillow-12.3.0.dist-info
# Reassert current OS-package floors for installed packages only.
RUN set -eux; \
apt-get update; \
security_packages="dotnet-host-8.0 dotnet-hostfxr-8.0 dotnet-runtime-8.0 libbrotli1 libnginx-mod-http-echo libnginx-mod-http-geoip2 libpcre2-8-0 nginx-common nginx-light"; \
installed_packages=""; \
for package in $security_packages; do \
if dpkg-query -W -f='${Status}' "$package" 2>/dev/null | grep -q "install ok installed"; then \
installed_packages="$installed_packages $package"; \
fi; \
done; \
if [ -n "$installed_packages" ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install -y --only-upgrade $installed_packages; \
fi; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# pmdarima 1.8.5 imports pkg_resources, removed by the setuptools security upgrade.
# Backport its upstream packaging.version replacement without changing AutoML's pmdarima pin.
# Migrate AutoML's verifier JSON lookup to importlib.resources for the same removal.
RUN find "$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/pmdarima" -type f -name '*.py' \
-exec sed -i 's/from pkg_resources import parse_version/from packaging.version import parse as parse_version/' {} + && \
! grep -R 'from pkg_resources import parse_version' \
"$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/pmdarima" && \
sed -i 's/OnnxIncompatiblePythonVersion = (3, 11)/OnnxIncompatiblePythonVersion = (3, 12)/' \
"$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/azureml/automl/core/onnx_convert/onnx_convert_constants.py" && \
grep -q 'OnnxIncompatiblePythonVersion = (3, 12)' \
"$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/azureml/automl/core/onnx_convert/onnx_convert_constants.py" && \
sed -i \
-e 's/^import pkg_resources/from importlib.resources import files/' \
-e "s/pkg_resources.resource_filename(PACKAGE_NAME, 'faults_verifier_message.json')/str(files(PACKAGE_NAME).joinpath('faults_verifier_message.json'))/" \
"$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/azureml/automl/runtime/faults_verifier.py"
# Torch 2.9 changed the ONNX exporter default. Preserve AutoML's legacy export contract.
# Backport the explicit choice in each vision wrapper until the SDK supplies it.
RUN set -eux; \
for wrapper in classification/models/base_model_wrapper.py \
object_detection/models/base_model_wrapper.py \
object_detection_yolo/models/yolo_wrapper.py; do \
path="$AZUREML_CONDA_ENVIRONMENT_PATH/lib/python3.11/site-packages/azureml/automl/dnn/vision/$wrapper"; \
sed -i '/torch\.onnx\.export(new_model,/,/dynamic_axes=/s/file_path,/file_path, dynamo=False,/' "$path"; \
python -c "import ast, pathlib, sys; \
path = pathlib.Path(sys.argv[1]); \
tree = ast.parse(path.read_text()); \
compile(tree, str(path), 'exec'); \
calls = [node for node in ast.walk(tree) if isinstance(node, ast.Call) and ast.unparse(node.func) == 'torch.onnx.export']; \
assert len(calls) == 1 and any(keyword.arg == 'dynamo' and isinstance(keyword.value, ast.Constant) and keyword.value.value is False for keyword in calls[0].keywords), path" "$path"; \
done
RUN python -c "import azureml.automl.dnn.vision.object_detection.runner; \
import torch; \
import torchvision; \
boxes = torch.tensor([[0., 0., 2., 2.], [0., 0., 2., 2.]]); \
scores = torch.tensor([0.9, 0.8]); \
assert torchvision.ops.nms(boxes, scores, 0.5).tolist() == [0]"