fix: [Bug]: PySDK V3: pydantic-core (2.42.0) incompatibility with sagemaker.ai_regist (5652)#5728
Draft
aviruthen wants to merge 1 commit intoaws:masterfrom
Conversation
…emaker.ai_regist (5652)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The issue is a pydantic/pydantic-core version incompatibility. sagemaker-core declares 'pydantic>=2.0.0,<3.0.0' as a dependency but does NOT declare pydantic-core. Pydantic requires an exact matching pydantic-core version (e.g., pydantic 2.11.5 requires pydantic-core==2.41.5). When users run 'pip install --force-reinstall', pip may resolve pydantic-core to a newer version (e.g., 2.42.0) that is incompatible with the installed pydantic version. This causes a SystemError at import time when any module transitively imports pydantic (e.g., DataSet → session_helper → pydantic). The fix is to either: (1) add pydantic-core as a dependency that will be co-resolved with pydantic, or (2) tighten pydantic constraints. The best approach is to let pydantic manage its own pydantic-core dependency but also exclude known-incompatible pydantic-core versions, plus add a runtime compatibility check that provides a helpful error message.
Related Issue
Related issue: 5652
Changes Made
sagemaker-core/pyproject.tomlsagemaker-core/src/sagemaker/core/_pydantic_compat.pysagemaker-core/src/sagemaker/core/__init__.pysagemaker-core/tests/unit/test_pydantic_compat.pyAI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat