build(setup): pin sagemaker<3 so import cohere_aws works again - #234
Open
tsushanth wants to merge 1 commit into
Open
build(setup): pin sagemaker<3 so import cohere_aws works again#234tsushanth wants to merge 1 commit into
import cohere_aws works again#234tsushanth wants to merge 1 commit into
Conversation
Closes cohere-ai#233. sagemaker 3.0 removed the `sagemaker.s3` module, taking `S3Downloader`, `S3Uploader`, and `parse_s3_url` with it. `cohere_aws/client.py:12` imports all three at module load: from sagemaker.s3 import S3Downloader, S3Uploader, parse_s3_url so any environment that resolves to sagemaker>=3 throws ModuleNotFoundError on the first `import cohere_aws` — long before the caller has a chance to do anything else. setup.py declared the dep as unpinned `sagemaker`, which is now wrong on any fresh install that picks the latest published version. Pin to <3 so installs continue to work; an inline comment links the issue and states that the long-term fix is to migrate the imports to sagemaker's v3 surface, at which point the constraint can be lifted. Matches what @robertkerr-cohere suggested on the issue thread.
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.
Summary
Closes #233.
sagemaker 3.0 removed the
sagemaker.s3module —S3Downloader,S3Uploader, andparse_s3_urlare no longer importable from that path.cohere_aws/client.py:12imports all three at module load:So any environment that resolves to
sagemaker>=3throwsModuleNotFoundErroron the firstimport cohere_aws, long before the caller has a chance to do anything else:setup.pydeclared the dep as unpinnedsagemaker, which is now wrong on any fresh install that picks the latest published version.Fix
Matches what @robertkerr-cohere suggested on the issue thread:
This PR takes the first half of his suggestion — restore importability today. The longer-term migration to sagemaker v3's APIs (where
S3Downloader/S3Uploadermoved tosagemaker.s3_utils, etc.) is a separate, larger change worth tracking in its own issue.The inline comment links #233 so a future maintainer trying to lift the constraint sees the migration prerequisite right there.
Test plan
pip install cohere-awsagainst this branch now resolvessagemaker<3andimport cohere_awssucceeds. Onmainthe same flow either fails at install (if pip happened to pick sagemaker>=3) or at first import (if a newer sagemaker was already in the env).boto3>=1.34.162constraint left untouched — only the sagemaker dep is changed.