Skip to content

[Feature] Provide official way to install with transformers 5.x (extra ideally or env var) #4022

Description

@Maxusmusti

Summary

Transformers 5.x support is documented as available (December release notes, Issue #3786), but the pyproject.toml constraint blocks installation:

transformers>4.51.3,...,<=4.57.6

This makes it impossible to install unsloth alongside packages that require transformers>=5.0.0 without workarounds like --no-deps.

Request

Provide an official mechanism to opt-in to transformers 5.x support. Two options:

Option A: New extra

  [project.optional-dependencies]
  transformers5 = [
      "transformers>=5.0.0",
  ]

Install with:
pip install unsloth[transformers5]

This option would likely be the easiest, both to add and maintain, as well as for people looking for an easy addition to their own pyproject.toml, requirements, scripts, etc.

Option B: Environment variable bypass

(In setup/pyproject)
if os.environ.get("UNSLOTH_ALLOW_TRANSFORMERS5"):
# Skip version constraint check

Why This Matters

Environment

  • unsloth 2026.2.1
  • transformers 5.x required by dependent package
  • uv/pip fails to resolve dependencies

References

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