Pin everything, or pin nothing
Three pinning strategies
| Mode | File | When to use |
|---|---|---|
python_env (pip) | python_env.yaml | Pure-Python projects, fastest to build. |
conda_env | conda.yaml | Native deps (CUDA, GDAL, blas variants). |
docker_env | Dockerfile | Heterogeneous deps or strict prod parity. |
Lockfiles matter
Pin exact versions (scikit-learn==1.4.2, not >=1.4). An MLflow run is only reproducible if the env is. Use pip freeze, conda env export --no-builds, or uv pip compile.
Production tip
Docker is the only mode that locks the OS as well as the Python layer. If you ever hit a 'works on Linux, breaks on macOS' bug (looking at you, numpy wheels), graduate to Docker.