Skip to content

Make torch an optional dependency / extra #5531

Open

Description

@firegate22

Modern packages use optional dependecies / extras for specific functionality. I assume this is very well possible for the sagemaker sdk.

A similar request was posted in discussions: #5441

I couldn't find any actual "issue" and hope this gets more visibility.

The main and most urgent topic is the dependency of pytorch which requires 354/620mb size in a clean venv. I would assume that most use cases don't need pytorch at all.

Activity

  1. kassick commented on Feb 11, 2026

    @kassick

    The packages sagemaker-{train,serve,mlops} are mentioned in the optional dependencies extras, but also added as non-optional dependencies in pyproject.toml

    This change was introduced in 869f3ee

    I'm not sure if the code was designed to handle optional dependencies or not, but pulling torch, cuda and the kitchen sink to use the SageMaker API is not ideal.

    [edit]: Depending on sagemaker-mlops instead of sagemaker-sdk also does not help much, since -mlops depends on -train, which then brings torch, cuda, etc.

  2. matteociccozzi-ah commented on Apr 14, 2026

    @matteociccozzi-ah

    Surprising this issue has been open for so long with no attention. Looking at the code doesn't seem like torch it actually needed in sagemaker-core.

  3. aW3st commented on May 26, 2026

    @aW3st

    This is blocking us from upgrading to Sagemaker 3. Would love an update from the maintainers.

  4. JoseJuan98 commented on Jun 1, 2026

    @JoseJuan98
    Contributor

    This seems to be fixed now in the latest version of the sagemaker-core package. But if you install sagemaker or sagemaker-{mlops,serve} the same issue arises as is a core dependency in the sagemaker-serve package, could this one also be optional?

    (Duplicated from issue 5457, but I wasn't sure in which one to comment)

  5. added a commit that references this issue on Aug 7, 2026
    38b75f5
  6. goelakash commented on Aug 7, 2026

    @goelakash
    Contributor

    Opened a PR to address this #6166

  7. added a commit that references this issue on Aug 7, 2026
    299438e
  8. aW3st commented on Oct 22, 2026

    @aW3st

    Disappointed to see no movement on (or even acknowledgment of) this issue for months. Not sure who to tag--@aviruthen? @mohamedzeidan2021? Can we merge @goelakash's PR?

  9. mohamedzeidan2021 commented on Oct 23, 2026

    @mohamedzeidan2021
    Collaborator

    Hi @aW3st, I apologize for the delay. Thank you for pinging again. We will prioritize and try to release a fix ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions