Skip to content

fix(serve): pin pandas below 3.1.0 to unblock serve unit tests - #6524

Merged
mufaddal-rohawala merged 2 commits into
aws:masterfrom
rsareddy0329:fix/serve-pin-pandas
Oct 23, 2026
Merged

mufaddal-rohawala merged 2 commits into
aws:masterfrom
rsareddy0329:fix/serve-pin-pandas

Conversation

@rsareddy0329

@rsareddy0329 rsareddy0329 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Issue

unit-tests (sagemaker-serve) is failing on open PRs (e.g. #6508, #6516) — this is environment/dependency churn, not a test or code regression.

The serve unit job runs three tox envs. py310 passes all 2176 tests; py311/py312 fail at pytest collection:

ImportError: C extension: None not built...
ERROR:   py311: commands failed
ERROR:   py312: commands failed

pandas is pulled in transitively (via mlflow) and is unpinned. The newly released pandas 3.1.0 (requires Python >= 3.11) now floats into the py311/py312 envs; its wheels are built against a newer NumPy C-ABI than those envs resolve (numpy==2.1.3), so pandas' compiled extension cannot load and import fails before any test runs. py310 is unaffected because it cannot install 3.x and stays on the working 2.3.3.

Until pandas 3.1.0 was released, py311/py312 resolved pandas 3.0.6 and passed — i.e. this went red purely due to the new release, with no code change.

Description of changes

Cap pandas below 3.1.0 in the serve test extra, restoring the last-known-good configuration:

"pandas>=2.3.0,<3.1.0",
  • py311/py312 -> 3.0.6 (what was green before the 3.1.0 release)
  • py310 -> 2.3.3 (pandas 3.x requires Python >= 3.11)

A hard ==3.0.6 is intentionally avoided — it would break the py310 env, which cannot install any 3.x.

Testing done

Locally, matching the CI Python versions:

  • py312: unconstrained pip install pandas -> 3.1.0 (the broken one); pip install "pandas>=2.3.0,<3.1.0" -> 3.0.6, and import pandas succeeds.
  • py310: pip install "pandas>=2.3.0,<3.1.0" -> 2.3.3 (3.x correctly excluded).
  • pyproject.toml parses; [test] extra carries pandas>=2.3.0,<3.1.0.

Full validation is the serve unit job on this PR across py310/py311/py312.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The sagemaker-serve unit-tests job runs py310/py311/py312 tox envs.
pandas is pulled in transitively (via mlflow) and is unpinned, so pip
resolves the newly released pandas 3.1.0 on py311/py312 (3.x requires
Python >=3.11). That build leaves the C extensions unbuilt in CI
("ImportError: C extension: None not built"), so pytest fails at
collection and the whole job goes red — even though py310 (pandas 2.3.3)
passes all tests. This is environment/dependency churn, unrelated to any
product change.

Pin pandas to the 2.x line in the test extra so all three envs resolve
the known-good 2.3.3 (what py310 already uses). Verified locally:
`pandas>=2.3.0,<3` resolves to 2.3.3 and imports cleanly on Python 3.12.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AI code review

This PR adds pandas>=2.3.0,<3 to the test extra in sagemaker-serve/pyproject.toml to unblock the py311/py312 serve unit-test CI envs, which were resolving the newly released pandas 3.1.0 and failing at collection time. The change is scoped to the test extra, uses a version range rather than an exact pin, and is consistent with sibling packages (sagemaker-core uses pandas>=2.0.0, <3.0.0, sagemaker-mlops uses pandas<3.0) and the existing conda_in_process.yml pin (pandas>=2.3.0). This also aligns with prior guidance to use ranges rather than exact pins (Source: #4983). No issues found.

Reviewed commit 4288634. Automated review; verify before acting.

Refine the pin to the last-known-good state: before pandas 3.1.0 was
released, the py311/py312 unit-test envs resolved pandas 3.0.6 and passed;
py310 resolves 2.3.3 (pandas 3.x requires Python >=3.11). 3.1.0's wheels
are built against a newer NumPy C-ABI than those envs resolve, so it fails
to import at collection. `>=2.3.0,<3.1.0` restores py311/py312 to 3.0.6
and keeps py310 on 2.3.3 -- exactly the configuration that was green
before the 3.1.0 release. A hard ==3.0.6 is intentionally avoided because
it would break the py310 env.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AI code review

This PR adds a pandas>=2.3.0,<3.1.0 pin to the test extra of sagemaker-serve/pyproject.toml to unblock py311/py312 unit test collection. The change is small, correct, and consistent with existing conventions elsewhere in the repo (e.g. sagemaker-core uses pandas>=2.0.0, <3.0.0). No code bugs found; one minor note about a mismatch between the PR description and the actual constraint.

Reviewed commit 372ddb3. Automated review; verify before acting.

# pandas 3.1.0 ships wheels built against a newer NumPy C-ABI than the
# py311/py312 test envs resolve, so it fails to import ("ImportError:
# C extension: None not built") at pytest collection time. The previous
# release 3.0.6 was passing on py311/py312; py310 stays on the 2.x line

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Low: Minor: the PR description states the constraint is pandas>=2.3.0,<3 (a hard cap below 3.x), but the actual pin here is pandas>=2.3.0,<3.1.0, which still permits pandas 3.0.x on py311/py312. The inline comment's reasoning is internally consistent (it says 3.0.6 passed and only 3.1.0 broke), so the <3.1.0 cap is intentional — just worth updating the PR description so reviewers aren't confused about which cap was actually applied. Note that team precedent (Source: #4983) discourages hard single-major caps; <3.1.0 is a narrower upper bound and acceptable, but consider whether <3.1.0 vs a future relaxation is tracked anywhere so the temporary cap doesn't linger.

@rsareddy0329 rsareddy0329 changed the title fix(serve): pin pandas to 2.x in test extra to unblock serve unit tests fix(serve): cap pandas below 3.1.0 to unblock serve unit tests Oct 22, 2026
@rsareddy0329 rsareddy0329 changed the title fix(serve): cap pandas below 3.1.0 to unblock serve unit tests fix(serve): pin pandas below 3.1.0 to unblock serve unit tests Oct 23, 2026
@mufaddal-rohawala
mufaddal-rohawala merged commit b92de52 into aws:master Oct 23, 2026
33 of 35 checks passed
evakravi added a commit to evakravi/sagemaker-python-sdk that referenced this pull request Oct 24, 2026
Brings in the serve test extra pin `pandas>=2.3.0,<3.1.0` (aws#6524), which is
what the `unit-tests (sagemaker-serve)` hook failed on: pandas 3.1.0 imports
with `ImportError: C extension: None not built` on py311 and py312.

---
X-AI-Prompt: Can you fix the failing PR hooks on my sagemaker-python-sdk pull request?
X-AI-Tool: claude-code

This branch was successfully deployed

1 active deployment
auto-approve — 372ddb3c Deployed Oct 22, 2026 by rsareddy0329 via wait-for-approval #2096
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.

2 participants