- Published on
uv venv VS python -m venv
TL;DR
| Feature | uv venv | python -m venv |
|---|---|---|
| Purpose | Create a virtual environment optimized for uv | Standard Python virtual environment |
| Speed | ⚡ Very fast | 🐢 Normal |
| Python version management | ✅ Can auto-download Python | ❌ Uses system Python |
| Reproducibility | ✅ Integrated with uv.lock | ❌ Manual |
| Tooling integration | Deep uv integration | Works with any tool |
| Standard library | ❌ External tool | ✅ Built-in |
python -m venv (Standard & Universal)
python -m venv .venv
source .venv/bin/activate
Pros
- Built into Python (no extra tools)
- Works everywhere
- Well-understood and predictable
- Ideal for simple scripts and legacy workflows
Cons
- Uses whatever Python is installed
- Slow environment creation
- No dependency locking or Python version pinning
Best when
- You want maximum portability
- You’re not using
uvfor dependency management - You’re working in constrained environments (CI images, minimal containers)
uv venv (Modern, Fast, Reproducible)
uv venv .venv
source .venv/bin/activate
Pros
⚡ Extremely fast (often instant)
Can download and pin Python versions
Automatically compatible with:
uv adduv pip installuv sync
Works seamlessly with
uv.lockIdeal for reproducible builds
Cons
- Requires installing
uv - Tighter coupling to
uvecosystem - Less familiar to teams used to pure
pip
Best when
- You already use
uv add,uv sync, oruv pip install - You care about reproducibility
- You want Python version isolation without pyenv
- You’re building containers or CI pipelines
Key Difference That Matters Most
Python version handling
python -m venv
# Uses: system Python
uv venv
# Can auto-download the exact Python version
Example:
uv venv --python 3.11
No pyenv. No system Python conflicts.
Typical uv Workflow (Recommended)
uv venv
source .venv/bin/activate
uv add requests
uv sync
This gives you:
- Locked dependencies
- Consistent Python version
- Fast installs
- Reproducible environments
Docker Note (Relevant to Your Previous Context)
In Dockerfiles:
- Prefer
uv venv+uv sync - Avoid activating venv (just use full path)
- Works well with private PyPI / Artifactory setups
Example:
RUN uv venv /opt/venv \
&& /opt/venv/bin/uv sync
Recommendation
- Already using
uv? → Useuv venv - Need universal compatibility? →
python -m venv - CI / Docker / reproducibility? →
uv venv