Environments: conda, pip, Docker

Three ways to pin the environment — pick the one your team can live with.

0/2 done

Pin everything, or pin nothing

Three pinning strategies

ModeFileWhen to use
python_env (pip)python_env.yamlPure-Python projects, fastest to build.
conda_envconda.yamlNative deps (CUDA, GDAL, blas variants).
docker_envDockerfileHeterogeneous 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.

Analogy

Three nested boxes. python_env is a cardboard box: enough for a paperback. conda_env is a wooden crate with foam: good for instruments. Docker is a shipping container: it carries the climate as well as the goods.

Reading in progress · 0 of 2 activities done