conda
**Conda** is an **open-source package manager and environment manager that handles both Python packages AND non-Python dependencies** — solving the critical problem that pip cannot install C libraries, CUDA toolkits, MKL math libraries, or specific Python versions, making conda the standard tool for scientific computing and machine learning environments where NumPy needs MKL, PyTorch needs CUDA, and different projects need different Python versions.
**What Is Conda?**
- **Definition**: A cross-platform package and environment manager (not just for Python — it handles R, Julia, C libraries, and system tools) that resolves complex dependency graphs and creates isolated environments with specific Python versions and library stacks.
- **Why Not Just pip?**: pip installs Python packages. Conda installs anything — Python packages, C/C++ libraries, CUDA toolkits, compilers. When you `conda install numpy`, conda installs NumPy linked to Intel MKL (optimized math library) — pip's numpy uses generic BLAS. This can make conda's NumPy 2-3× faster for linear algebra.
- **The Dependency Solving**: pip installs packages one at a time and can create broken states. Conda solves the entire dependency graph before installing anything, ensuring all packages are compatible.
**Anaconda vs Miniconda vs Mamba**
| Distribution | Size | What's Included | Best For |
|-------------|------|----------------|----------|
| **Anaconda** | ~3GB | Python + 250+ scientific packages pre-installed | Beginners, want everything out-of-box |
| **Miniconda** | ~50MB | Python + conda only (install what you need) | Experienced users, CI/CD, Docker |
| **Mamba** | ~50MB | Drop-in conda replacement (C++ solver, 10× faster) | Anyone frustrated with conda's speed |
| **Miniforge** | ~50MB | Miniconda but defaults to conda-forge channel | Open-source preference |
**Essential Commands**
```bash
# Create environment with specific Python version
conda create -n myproject python=3.10
# Activate
conda activate myproject
# Install packages (from conda-forge for latest)
conda install -c conda-forge numpy pandas scikit-learn
# Install CUDA toolkit (pip can't do this!)
conda install -c conda-forge cudatoolkit=11.8
# Export environment
conda env export > environment.yml
# Reproduce elsewhere
conda env create -f environment.yml
```
**Conda vs pip vs uv**
| Feature | conda | pip + venv | uv |
|---------|-------|-----------|-----|
| **Python version management** | Yes (any version) | No (use system Python) | Yes |
| **Non-Python packages** | Yes (CUDA, MKL, FFmpeg) | No | No |
| **Dependency resolution** | Full SAT solver (before install) | Sequential (can break) | Full resolver (fast) |
| **Speed** | Slow (use Mamba for 10× faster) | Fast | Fastest (Rust) |
| **Environment file** | environment.yml | requirements.txt | requirements.txt |
| **Best for** | Scientific computing, CUDA | Web dev, general Python | Modern Python projects |
**When to Use Conda vs pip**
| Scenario | Use Conda | Use pip |
|----------|----------|---------|
| Need specific CUDA version | ✓ | Cannot install CUDA |
| Need Python 3.8 + 3.11 on same machine | ✓ | Use pyenv + venv |
| Web development (Django, Flask) | Overkill | ✓ |
| Scientific stack (NumPy + MKL, SciPy) | ✓ (optimized builds) | Works but slower |
| Docker/CI (minimal image) | Miniconda | ✓ (lighter) |
**Conda is the standard environment manager for scientific Python and machine learning** — uniquely capable of installing non-Python dependencies (CUDA, MKL, C libraries) alongside Python packages, solving complex dependency graphs before installation, and managing multiple Python versions per project, making it essential for data science teams working with GPU-accelerated ML frameworks.