Production ML Fails from Hidden Changes, Not Models

Models that shine in Jupyter notebooks often break in production because of untracked changes like pip install pandas without version pins. After 4+ years shipping Python ML systems, the fix is boring discipline: treat reliability as repeatable habits, not smarter algorithms. Unpinned deps cause outputs to drift even if "nothing changed," leading to 3AM alerts.

Freeze All Dependencies for Exact Reproducibility

Avoid version floats by pinning precisely:

  • Basic: pip freeze > requirements.txt captures your full environment.
  • Better: Use pip-toolspip install pip-tools, then pip-compile requirements.in for locked, minimal requirements.txt.

This ensures identical runs across dev, staging, and prod, eliminating "it works on my machine" issues. Example shift:

Bad: pip install pandas

Good: pip install pandas==2.2.1

Apply to every dep, no exceptions, to build systems that survive real-world chaos.