fix(remote): remove -U flag from auto-injected sagemaker requirements install#5922
Open
nileshpatil6 wants to merge 1 commit into
Open
fix(remote): remove -U flag from auto-injected sagemaker requirements install#5922nileshpatil6 wants to merge 1 commit into
nileshpatil6 wants to merge 1 commit into
Conversation
The @Remote decorator injects sagemaker>=3.2.0,<4.0.0 into a requirements file and installed it with pip install -r ... -U. The -U flag forces pip to upgrade sagemaker to the latest version within the range even if a compatible version is already installed. This created a version mismatch between the client (which serialized the function at version 3.5.0) and the container (which deserialized at 3.11.0), causing DeserializationError. Remove the -U flag from _install_requirements_txt and _install_req_txt_in_conda_env in both sagemaker-core and sagemaker-train. The version constraint already ensures compatibility; forced upgrades are not needed and actively harmful when the serialization format changes between minor versions. Fixes aws#5872 Signed-off-by: nileshpatil6 <technil6436@gmail.com>
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.
Fixes #5872
What happened
The
@remote(and@step) decorator injectssagemaker>=3.2.0,<4.0.0into a temporary requirements file, then installs it with:The
-Uflag forces pip to upgrade sagemaker to the latest version within that range, even when a compatible version is already installed. The logs show this clearly:After the forced upgrade, the container tries to deserialize a payload serialized by the 3.5.0 client using a different format, which throws
DeserializationError.Fix
Remove the
-Uflag from_install_requirements_txtand_install_req_txt_in_conda_envin bothsagemaker-coreandsagemaker-train. The version constraint (>=3.2.0,<4.0.0) already guarantees a compatible version will be present; there is no reason to force an upgrade.Files changed
sagemaker-core/src/sagemaker/core/remote_function/runtime_environment/runtime_environment_manager.pysagemaker-train/src/sagemaker/train/remote_function/runtime_environment/runtime_environment_manager.pyTesting
Existing unit tests pass (
47 passedintest_runtime_environment_manager.pyfor sagemaker-core). No test changes needed since the tests mock_run_shell_cmdand verify it is called, which still holds.