> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/astral-sh/uv/llms.txt
> Use this file to discover all available pages before exploring further.

# uv pip freeze

> List installed packages in requirements format.

`uv pip freeze` outputs installed packages in a format compatible with `requirements.txt`. It is similar to `pip freeze` but faster and integrates with uv's caching system.

## Usage

```bash theme={null}
# List all installed packages
uv pip freeze

# Output to file
uv pip freeze > requirements.txt

# Exclude specific packages
uv pip freeze --exclude setuptools --exclude pip
```

## Arguments

### Filtering Options

<ParamField body="--exclude" type="package[]">
  Exclude specific packages from output.

  ```bash theme={null}
  uv pip freeze --exclude setuptools --exclude wheel
  ```
</ParamField>

<ParamField body="--exclude-editable">
  Exclude editable packages from output.

  ```bash theme={null}
  uv pip freeze --exclude-editable
  ```
</ParamField>

### Python Environment

<ParamField body="-p, --python" type="string">
  Python interpreter from which to list packages.

  By default, lists from virtual environment or system Python if no venv is found.

  ```bash theme={null}
  uv pip freeze --python 3.11
  uv pip freeze --python /path/to/python
  ```

  Environment: `UV_PYTHON`
</ParamField>

<ParamField body="--system">
  List packages from system Python, ignoring virtual environments.

  ```bash theme={null}
  uv pip freeze --system
  ```

  Environment: `UV_SYSTEM_PYTHON`
</ParamField>

<ParamField body="--path" type="path[]">
  List packages from specific installation paths.

  Can be provided multiple times.

  ```bash theme={null}
  uv pip freeze --path /opt/myapp/lib/python3.11/site-packages
  ```
</ParamField>

<ParamField body="-t, --target" type="path">
  List packages from a `--target` directory.

  ```bash theme={null}
  uv pip freeze --target ./libs
  ```
</ParamField>

<ParamField body="--prefix" type="path">
  List packages from a `--prefix` directory.

  ```bash theme={null}
  uv pip freeze --prefix /opt/myapp
  ```
</ParamField>

### Validation

<ParamField body="--strict">
  Validate the environment, detecting packages with missing dependencies.

  ```bash theme={null}
  uv pip freeze --strict
  ```
</ParamField>

## Output Format

The output is in `requirements.txt` format:

```txt theme={null}
certifi==2024.2.2
charset-normalizer==3.3.2
idna==3.6
requests==2.31.0
urllib3==2.2.1
```

### Editable Packages

Editable packages are listed with their source location:

```txt theme={null}
-e /path/to/my-package
-e git+https://github.com/user/repo.git@main#egg=my-package
```

## Examples

### Basic Usage

```bash theme={null}
# List all packages
uv pip freeze

# Save to file
uv pip freeze > requirements.txt

# Append to file
uv pip freeze >> requirements.txt
```

### Filter Output

```bash theme={null}
# Exclude common tools
uv pip freeze --exclude pip --exclude setuptools --exclude wheel

# Exclude editable packages
uv pip freeze --exclude-editable

# Combine filters
uv pip freeze --exclude-editable --exclude setuptools
```

### Specific Environment

```bash theme={null}
# From specific Python
uv pip freeze --python 3.11

# From system Python
uv pip freeze --system

# From target directory
uv pip freeze --target ./libs
```

### Validation

```bash theme={null}
# Check for missing dependencies
uv pip freeze --strict
```

## Use Cases

### Generate Requirements File

```bash theme={null}
# Create requirements.txt from current environment
uv pip freeze > requirements.txt
```

### Compare Environments

```bash theme={null}
# Compare local and production
uv pip freeze > local-requirements.txt
uv pip freeze --python /path/to/prod/python > prod-requirements.txt
diff local-requirements.txt prod-requirements.txt
```

### Docker Images

```bash theme={null}
# Capture exact environment for Docker
uv pip freeze > requirements.txt
```

```dockerfile theme={null}
# Dockerfile
COPY requirements.txt .
RUN uv pip install -r requirements.txt
```

### Debugging

```bash theme={null}
# Check what's actually installed
uv pip freeze --strict
```

## Differences from pip freeze

`uv pip freeze` is largely compatible with `pip freeze`:

```bash theme={null}
# pip command
pip freeze

# Equivalent uv command
uv pip freeze
```

### Key Differences

1. **Performance**: uv is faster, especially with large environments
2. **Default environment**: uv requires virtual environment by default
3. **Output format**: Identical to pip freeze
4. **Validation**: uv adds `--strict` for dependency checking

### Migration from pip

```bash theme={null}
# Replace in scripts
pip freeze > requirements.txt
# becomes
uv pip freeze > requirements.txt
```

## Comparison with uv pip list

`uv pip freeze` and `uv pip list` serve different purposes:

| Feature        | `uv pip freeze`       | `uv pip list`        |
| -------------- | --------------------- | -------------------- |
| Format         | requirements.txt      | Human-readable table |
| Editables      | Shows source paths    | Shows as installed   |
| Use case       | Reproducible installs | Viewing packages     |
| Output formats | Text only             | Text, JSON, freeze   |

```bash theme={null}
# For requirements files
uv pip freeze > requirements.txt

# For viewing/inspection
uv pip list

# For freeze format from list
uv pip list --format freeze
```

## Related Commands

* [`uv pip list`](/cli/pip-list) - List packages in table format
* [`uv pip show`](/cli/pip-show) - Show package details
* [`uv pip compile`](/cli/pip-compile) - Generate lockfile with resolution
