Skip to content

fix(deps): Python 3.11 and Pillow 13.0.0 for the test sandbox harness - #163

Merged
rvanderwerf merged 3 commits into
mainfrom
python311-sandbox-jp6
Nov 25, 2026
Merged

rvanderwerf merged 3 commits into
mainfrom
python311-sandbox-jp6

Conversation

@rvanderwerf

Copy link
Copy Markdown
Contributor

Problem

The workflow test sandbox image (edge-cv-portal/test-sandbox) runs its harness on Ubuntu 22.04's Python 3.10 and pins Pillow 12.3.0. Pillow 12.3.0 is affected by 43 Pillow advisories (5 critical, 24 high, 14 medium). The most severe, GHSA-5x8w-8jj5-q52h, is critical: a heap overflow in the FlashPix decoder. Pillow 13.0.0 is the first release that fixes them. It requires Python 3.11 or later and ships no Python 3.10 wheel, so #159 left the sandbox at 12.3.0.

Changes

The harness moves to Python 3.11. The image keeps its Ubuntu 22.04 base, GStreamer 1.20 and Triton 24.08.

  • test-sandbox/Dockerfile
    • Right after the first apt layer, the image installs CPython 3.11 from the deadsnakes PPA, as src/backend/Dockerfile.jp6 does on the same Ubuntu release, and creates a venv at /opt/dda/harness-venv.
    • Ubuntu's python3-gi and python3-gst-1.0 exist only for Python 3.10, so pip builds pycairo 1.23.0 and PyGObject 3.42.2, the versions LocalServer pins, for the venv.
    • requirements.txt is installed into the venv. A new build gate fails the image unless the venv runs Python 3.11 with the Pillow that requirements.txt pins and imports boto3 and the GStreamer bindings.
    • CMD runs the venv's python. The venv is not on PATH.
  • The system python3 (3.10) stays for the Triton python-backend stub. The stub links libpython3.10 and runs the staged models with numpy, onnxruntime, OpenCV and scikit-learn. That interpreter no longer gets boto3 or Pillow, which the stub's models do not import. The only Pillow left in the image is the venv's 13.0.0.
  • test-sandbox/requirements.txt: Pillow==13.0.0.
  • Integration tests. The slim image in tests/integration/conftest.py gets the same layers, gate and CMD. test_custom_plugin_e2e.py and test_sandbox_e2e.py, which start the harness themselves, use the venv's python.
  • README and CHANGELOG (one entry in edge-cv-portal/CHANGELOG.md).
  • Size. The full x86_64 image grows by about 0.47 GB and the slim arm64 test image by 0.41 GB, mostly for Python 3.11 and the toolchain the bindings build with.

JP6 is held at Python 3.10

This PR does not change JP6. src/backend/Dockerfile.jp6 and src/backend/requirements.txt are unchanged, and nothing under src/ changes.

  • The JP6 LocalServer backend stays on Python 3.10 and keeps Pillow==12.3.0; python_version < "3.11". It runs vLLM in-process, and the vllm, torch, torchvision and triton wheels it installs from the Jetson AI Lab jp6/cu126 index exist only for Python 3.10.
  • JP6's separate Python 3.11 install for the Triton Python-backend stub has pinned Pillow 13.0.0 since fix(deps): move the remaining Python 3.11+ Pillow pins to 13.0.0 #159.
  • JP6 can move to Python 3.11 in a later change, once Python 3.11 builds of those wheels exist or vLLM is installed another way, and once the JP6 image can be built and checked on a device.

Testing

Everything ran on an arm64 host in local Docker: the slim test image natively, and the full x86_64 image under qemu. The image was not run on Fargate and was not pushed to any registry.

Check Result
Unit tests (-m "not integration"), host Python 3.9 332 passed, 12 deselected
Unit tests under Python 3.11 with Pillow 13.0.0 332 passed, 12 deselected
Integration suite, slim image built natively (arm64) 8 passed, 4 failed: the 4 that also fail on main (below)
Full x86_64 image built from this branch under qemu, with the DDA plugin set staged (90 min) every build gate passes
Integration suite against the full image (SANDBOX_IT_IMAGE, under qemu) 8 passed, the same 4 failed
Triton stub smoke test in the full image passed
docker build --check no warnings, as on main
  • Build gates. tritonserver, the python-backend stub, libgstemltriton.so and libgstemlcapture.so resolve all their libraries, and the new gate prints harness python 3.11.18 Pillow 13.0.0 boto3 1.34.162 GStreamer 1.20.3. The only plugin warning is the existing one for libgstemlvideocapture.so, whose libavcodec.so.57, libavformat.so.57, libavutil.so.55 and libswscale.so.4 Ubuntu 22.04 does not ship.
  • Image contents (slim and full). The venv runs Python 3.11.18 with Pillow 13.0.0, boto3 1.34.162, PyGObject 3.42.2, pycairo 1.23.0 and GStreamer 1.20.3, and loads no gst-python overrides. The system python3 is 3.10.12 without PIL or boto3. In the full image it imports numpy 1.26.4, onnxruntime 1.18.1, OpenCV 4.10.0 and scikit-learn 1.3.2. Each image's only Pillow is the venv's 13.0.0, and no python3-pil package is installed. CMD is the venv's python, and PATH does not contain the venv.
  • Triton stub smoke test. tritonserver loads a python-backend model that imports the DDA python-backend modules, and inference returns [2.0, 4.0, 6.0, 8.0] for [1, 2, 3, 4]. The stub ran Python 3.10.12 with prefix /usr and no venv path on sys.path.
  • The 4 failures on main and on this branch are unrelated to this change and left as they are:
    • test_report_shape_enum_capture_and_blurbs (the report's padsError/pads keys);
    • test_harness_sources_contain_no_greengrass_references (a model_staging.py docstring);
    • test_e2e_sample_workflow_runs_against_test_dataset and test_harness_run_uses_only_s3_no_greengrass (the sample workflow's unknown node type camera_source).

Notes for reviewers

  • Rollout. Portal test runs on Fargate use the image's CMD: the test runner and node designer task definitions set only environment variables. Each environment builds and pushes the image by hand (test-sandbox/README.md, "Build and push"). Until it does, its test runs keep the image they have.
  • Coverage limit. No test runs the full path from the harness through in-process emltriton to the python stub, and the sample workflow test fails at compile on main too. That path rests on the stub's ldd gate, the smoke test and the environment checks above.
  • Alerts. After the merge, the 43 Pillow alerts on edge-cv-portal/test-sandbox/requirements.txt should close. The JP6 backend's Pillow 12.3.0 has no alert of its own: for the marker-split pin in src/backend/requirements.txt, GitHub's dependency graph records only the 13.0.0 line.

The workflow test sandbox image (edge-cv-portal/test-sandbox) ran its
harness on Ubuntu 22.04's Python 3.10 and pinned Pillow 12.3.0, which
the open Pillow advisories affect. Pillow 13.0.0 is the first release
that fixes them; it needs Python 3.11 or later and ships no cp310
wheel. The harness moves to Python 3.11; the image keeps its Ubuntu
22.04 base and GStreamer 1.20.
- test-sandbox/Dockerfile: CPython 3.11 from the deadsnakes PPA, as in
  src/backend/Dockerfile.jp6 on the same Ubuntu release, in a venv at
  /opt/dda/harness-venv, added right after the first apt layer.
  Ubuntu's python3-gi and python3-gst-1.0 exist only for 3.10, so pip
  builds pycairo 1.23.0 and then PyGObject 3.42.2 for the venv
  (LocalServer's pins and install order). requirements.txt goes into
  the venv. A new build gate fails the image unless the venv runs 3.11
  with the pinned Pillow and imports boto3 and Gst. CMD runs the venv's
  python.
- The system python3 (3.10) stays for the Triton 24.08 python-backend
  stub, which links libpython3.10 and runs the staged models with
  numpy, onnxruntime, OpenCV and scikit-learn. The venv stays off PATH,
  so the stub keeps that interpreter. The stub's models import neither
  PIL nor boto3, and the system python3 no longer gets them.
- test-sandbox/requirements.txt: Pillow==13.0.0.
- tests/integration/conftest.py: the slim image gets the same layers,
  gate and CMD. test_custom_plugin_e2e.py and test_sandbox_e2e.py start
  the harness with the venv's python.
- README and CHANGELOG.
JP6 is unchanged: its LocalServer backend stays on Python 3.10 with
Pillow 12.3.0 from src/backend/requirements.txt, because the vLLM,
torch, torchvision and triton wheels it installs from the Jetson AI Lab
jp6/cu126 index exist only for cp310. Nothing under src/ changed.
Verified on an arm64 host, local Docker only:
- Unit tests (-m "not integration"), host Python 3.9:
  332 passed, 12 deselected.
- The same under Python 3.11.17 with Pillow 13.0.0:
  332 passed, 12 deselected.
- Integration suite, slim image built natively (arm64):
  4 failed, 8 passed, 1 warning. The 4 failures are the same ids and
  reasons as on main (b30a029) and unrelated to this change:
  test_report_shape_enum_capture_and_blurbs (padsError/pads keys),
  test_harness_sources_contain_no_greengrass_references (a
  model_staging.py docstring), and
  test_e2e_sample_workflow_runs_against_test_dataset and
  test_harness_run_uses_only_s3_no_greengrass (the sample workflow's
  unknown node type camera_source).
- Slim image: the venv runs Python 3.11.18 with Pillow 13.0.0, boto3
  1.34.162, PyGObject 3.42.2, pycairo 1.23.0 and GStreamer 1.20.3, and
  loads no gst-python overrides. The system python3 is 3.10.12 without
  PIL or boto3. The image's only Pillow is the venv's 13.0.0.
- docker build --check on the Dockerfile:
  no warnings, as on main.
- The new RUN layers, the gate and CMD are identical in the Dockerfile
  and the slim Dockerfile.
- Full x86_64 image, built from this tree under qemu with the staged
  DDA plugin set (90 min): every build gate passes. tritonserver, the
  python-backend stub, libgstemltriton.so and libgstemlcapture.so
  resolve all their libraries, and the new gate prints "harness python
  3.11.18 Pillow 13.0.0 boto3 1.34.162 GStreamer 1.20.3". The only
  plugin warning is the expected one for libgstemlvideocapture.so,
  whose libavcodec.so.57, libavformat.so.57, libavutil.so.55 and
  libswscale.so.4 Ubuntu 22.04 does not ship.
- Full image facts: CMD is the venv's python, and PATH does not contain
  the venv. The venv matches the slim image's. The system python3 is
  3.10.12 with numpy 1.26.4, onnxruntime 1.18.1, OpenCV 4.10.0 and
  scikit-learn 1.3.2, without PIL or boto3. The only Pillow in the
  image is the venv's 13.0.0, and no python3-pil package is installed.
  The image grows by about 0.47 GB net (docker history): 428 MB for
  Python 3.11 and the bindings' build toolchain, 30 MB for the venv
  with its bindings, and 8 MB more for the harness requirements (44 MB
  in the venv, against 36 MB in the system python3 of the previous
  image).
- Triton stub smoke test in the full image: tritonserver loads a
  python-backend model that imports the DDA python-backend modules,
  and inference returns [2.0, 4.0, 6.0, 8.0] for [1, 2, 3, 4]. The stub
  ran Python 3.10.12 with prefix /usr and no venv path on sys.path.
- Integration suite against the full image (SANDBOX_IT_IMAGE, under
  qemu): 4 failed, 8 passed, 1 warning; the same 4 baseline failures.
The image was not run on Fargate and is not published.
main gained PR #162 (optional NAT gateway for the Build Fleet VPC)
after this branch was pushed. The only conflict was one hunk in
edge-cv-portal/CHANGELOG.md, where both sides added a top section
under [Unreleased]. Both sections are kept, each exactly as on its
side, this branch's first:
- "Security - Pillow 13.0.0 and Python 3.11 for the workflow test
  sandbox image" (this branch);
- "Added - Build Fleet: optional NAT gateway for the build instances"
  (main).
No other file overlaps: main changed nothing under
edge-cv-portal/test-sandbox or the workflow_core layer.

Verified on the merged tree:
- test-sandbox unit tests: 332 passed, 12 deselected on Python 3.9, and
  332 passed, 12 deselected on Python 3.11 with Pillow 13.0.0.
- .github/scripts/check_windows_paths.py: all 7,588 tracked paths
  pass.
- The diff against main is exactly this branch's change before the
  merge (7 files), and every other file is main's. No conflict
  markers; hygiene grep over the diff and this message: clean.
main gained PR #164 (RF-DETR-Seg instance segmentation) after this
branch last merged main. The only conflict was one hunk in
edge-cv-portal/CHANGELOG.md, where both sides added a top section
under [Unreleased]. Both sections are kept, each exactly as on its
side, this branch's first:
- "Security - Pillow 13.0.0 and Python 3.11 for the workflow test
  sandbox image" (this branch);
- "Added - RF-DETR-Seg instance segmentation" (main).

main also changed eight files under
edge-cv-portal/test-sandbox/dda_triton_resources, the Triton
python-backend modules the image copies for the stub. This branch
does not touch them, so they come in as on main, and nothing else
overlaps: main changed nothing else under edge-cv-portal/test-sandbox
and nothing in the workflow_core layer. These modules run in the
stub's system python3 (3.10), which this branch leaves without Pillow
and boto3. None of the 46 modules imports either, and all 46
import with that interpreter in an image built from this branch's
Dockerfile.

Verified on the merged tree:
- test-sandbox unit tests: 332 passed, 12 deselected on Python 3.9, and
  332 passed, 12 deselected on Python 3.11 with Pillow 13.0.0.
- .github/scripts/check_windows_paths.py: all 7,651 tracked paths
  pass.
- The diff against main is exactly this branch's change (7 files),
  and every other file is main's. No conflict markers; hygiene grep
  over the diff and this message: clean.
@rvanderwerf
rvanderwerf merged commit 268dc5f into main Nov 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant