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.txtIn 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
uv pip install: Fast Installs Command ReferenceReference for uv pip install in CI: a fast, pip-compatible installer, shared flags, the must-target-an-enviro…
python -m venv: Virtual Environment Command ReferenceReference for python -m venv in CI: creating an isolated environment, options, and a workflow example showing…
source venv/bin/activate: Activation Command ReferenceReference for activating a virtualenv in CI: source venv/bin/activate on Linux/macOS, the Windows path, and w…