Skip to content
Latchkey

uv venv: Fast Virtual Environment Command Reference

Create a venv in a fraction of the time.

uv venv creates a virtual environment much faster than python -m venv and can fetch a managed Python version on demand. It is the usual first step in a uv-based CI job.

Common flags / usage

  • uv venv -- create .venv with the default interpreter
  • --python 3.12 -- pin a Python version (downloaded if absent)
  • uv venv myenv -- name the environment directory
  • follow with uv pip install or uv sync

Example

shell
- uses: astral-sh/setup-uv@v5
- run: uv venv --python 3.12
- run: uv pip install -r requirements.txt

In CI

Pass --python to build the environment on an exact version; uv can download a managed interpreter if it is missing, removing a separate setup-python step. As with any venv, activation does not persist across steps -- target the env by path or with --python.

Key takeaways

  • uv venv creates virtual environments far faster than python -m venv.
  • --python pins (and can download) a specific interpreter.
  • It replaces a separate setup-python step in many uv-based jobs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →