Skip to content

[TESTS] Fix ONNX serialization test failures: setuptools bump + converter bug fix#36854

Open
mvafin wants to merge 1 commit into
openvinotoolkit:masterfrom
mvafin:fix/onnx-serialization-tests-setuptools
Open

[TESTS] Fix ONNX serialization test failures: setuptools bump + converter bug fix#36854
mvafin wants to merge 1 commit into
openvinotoolkit:masterfrom
mvafin:fix/onnx-serialization-tests-setuptools

Conversation

@mvafin

@mvafin mvafin commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Details:

  • Bump setuptools upper bound from <80.10 to <84 to allow 80.10.x patch releases and current 83.x
  • Fix wrong method call in onnx_prototxt_converter.py: serialize_proto(bytes, ModelProto())deserialize_proto(bytes, ModelProto()) in the bytes branch of save_model (serialize_proto takes one argument; deserialize_proto is the two-argument form that parses raw bytes into a proto message)
  • Continuation of Update setuptools requirement from <80.10,>=77 to >=77,<82.1 in /src/bindings/python #34455

Tickets:

AI Assistance:

  • AI assistance used: yes
  • Root cause traced by inspecting check_python_requirements.py / test_model_zoo.cmake chain and verifying onnx.serialization API signatures. Changes manually reviewed.

@mvafin mvafin requested review from a team as code owners July 13, 2026 15:12
@github-actions github-actions Bot added category: Python API OpenVINO Python bindings category: ONNX FE OpenVINO ONNX FrontEnd category: dependency_changes Pull requests that update a dependency file category: PyTorch FE OpenVINO PyTorch Frontend labels Jul 13, 2026
@mvafin mvafin force-pushed the fix/onnx-serialization-tests-setuptools branch from 623a900 to 0696506 Compare July 13, 2026 15:15
@github-actions github-actions Bot removed the category: PyTorch FE OpenVINO PyTorch Frontend label Jul 13, 2026
@mvafin mvafin force-pushed the fix/onnx-serialization-tests-setuptools branch from 0696506 to dd6c7ea Compare July 15, 2026 10:12
@mvafin mvafin requested a review from a team as a code owner July 15, 2026 10:12
@github-actions github-actions Bot added category: build OpenVINO cmake script / infra and removed category: ONNX FE OpenVINO ONNX FrontEnd labels Jul 15, 2026
### Details:
 - Root cause: `check_python_requirements.py` used `pkg_resources`, which
   setuptools removed in 82.0. When CI installs a modern setuptools, the
   import fails, the requirement check exits non-zero, `onnx_FOUND` is set
   to OFF, and the `.prototxt` -> `.onnx` test-model conversion is skipped.
   The serialization tests (`SerializationDeterministicityTest`,
   `ONNXSerialization/SerializationTest`) then fail because their `.onnx`
   models are missing.
 - Rewrite `check_python_requirements.py` on top of stdlib
   `importlib.metadata` + `packaging` instead of the removed `pkg_resources`
   API, so requirement/constraint validation keeps working with any
   setuptools version. Also strip inline comments from constraints lines.
 - Bump `setuptools` upper bound from `<80.10` to `<84` now that the check
   no longer depends on `pkg_resources`.

### Tickets:
 - CVS-188510

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR targets ONNX serialization test failures by relaxing the Python setuptools constraint and updating the CMake-time Python requirement checker to work without pkg_resources (which is removed in newer setuptools), keeping the developer/test environment checks compatible with modern Python packaging tooling.

Changes:

  • Bump setuptools upper bound in constraints.txt from <80.10 to <84.
  • Replace pkg_resources.require(...) usage in check_python_requirements.py with an importlib.metadata + packaging-based validation loop.
  • Improve constraints parsing by stripping inline comments in constraints.txt entries before processing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/bindings/python/constraints.txt Expands allowed setuptools versions to unblock environments using newer releases.
cmake/developer_package/check_python_requirements.py Migrates requirements validation off pkg_resources to keep CMake dependency checks working with newer setuptools.

build<1.6
pygments>=2.8.1
setuptools>=77,<80.10
setuptools>=77,<84
Comment on lines 49 to 52
line = line.replace("\n", "")
if re.search("\W", line):
requirements.append(line)
else:
Comment on lines +62 to +66
# Validate each requirement against the installed distributions. Uses
# importlib.metadata + packaging instead of the removed pkg_resources API
# (dropped in setuptools>=82), so the check keeps working with modern
# setuptools. Raises to signal an unsatisfied requirement to the caller.
for raw in requirements:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build OpenVINO cmake script / infra category: dependency_changes Pull requests that update a dependency file category: Python API OpenVINO Python bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants