Skip to content

Make matplotlib an optional dependency for algorithm-only users - happy to PR #1162

Description

@bartolomeo3000

Hello, and thank you for maintaining mlxtend.

Question

Would you be open to making matplotlib an optional dependency, installable via an extras group (e.g. pip install mlxtend[plotting]) rather than a hard requirement?

I'm happy to open a PR if you're receptive to the idea. Thanks for considering it.

Why this matters

  • matplotlib is used only for visualization but is currently a hard dependency, so it is always installed regardless of whether plotting is ever used.
  • It pulls in a its chain of transitive dependencies.
  • Users who only need the algorithmic modules (frequent_patterns, preprocessing, feature_selection, etc.) currently have no way to avoid this overhead.
  • It can create version conflicts in constrained environments.

Precedent

scikit-learn takes this approach — matplotlib is not listed as a runtime dependency at all. It is only imported inside the individual functions that need it, so users who never call plotting functions are never affected. mlxtend's plotting modules are already similarly separated, so the runtime already works without matplotlib for algorithm-only use cases.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions