> ## 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 remove

> Remove dependencies from a Python project

Remove dependencies from the project's `pyproject.toml`.

## Usage

```bash theme={null}
uv remove [OPTIONS] <PACKAGES>...
```

## Description

Remove dependencies from the project's `pyproject.toml` file.

If multiple entries exist for a given dependency (i.e., each with different markers), all of the entries will be removed.

The lockfile and project environment will be updated to reflect the removed dependencies. To skip updating the lockfile, use `--frozen`. To skip updating the environment, use `--no-sync`.

If any of the requested dependencies are not present in the project, uv will exit with an error.

If a package has been manually installed in the environment (i.e., with `uv pip install`), it will not be removed by `uv remove`.

uv will search for a project in the current directory or any parent directory. If a project cannot be found, uv will exit with an error.

## Arguments

<ParamField path="PACKAGES" type="string[]" required>
  The names of the dependencies to remove (e.g., `ruff`).

  Packages are specified by name, not as full PEP 508 requirements.
</ParamField>

## Options

### Dependency Groups

<ParamField path="--dev" flag>
  Remove the packages from the development dependency group.

  This option is an alias for `--group dev`.

  Environment variable: `UV_DEV`
</ParamField>

<ParamField path="--optional" type="string">
  Remove the packages from the project's optional dependencies for the specified extra.
</ParamField>

<ParamField path="--group" type="string">
  Remove the packages from the specified dependency group.
</ParamField>

### Syncing Options

<ParamField path="--no-sync" flag>
  Avoid syncing the virtual environment after re-locking the project.

  Environment variable: `UV_NO_SYNC`
</ParamField>

### Locking Options

<ParamField path="--locked" flag>
  Assert that the `uv.lock` will remain unchanged.

  Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.

  Environment variable: `UV_LOCKED`
</ParamField>

<ParamField path="--frozen" flag>
  Remove dependencies without re-locking the project.

  The project environment will not be synced.

  Environment variable: `UV_FROZEN`
</ParamField>

### Workspace Options

<ParamField path="--package" type="string">
  Remove the dependencies from a specific package in the workspace.
</ParamField>

<ParamField path="--script" type="path">
  Remove the dependency from the specified Python script, rather than from a project.

  If provided, uv will remove the dependency from the script's inline metadata table, in adherence with PEP 723.
</ParamField>

### Environment Options

<ParamField path="--active" flag>
  Prefer the active virtual environment over the project's virtual environment.

  If the project virtual environment is active or no virtual environment is active, this has no effect.
</ParamField>

<ParamField path="--python" type="string">
  The Python interpreter to use for resolving and syncing.

  See `uv help python` for details on Python discovery and supported request formats.

  Short form: `-p`\
  Environment variable: `UV_PYTHON`
</ParamField>

## Examples

### Remove a single package

```bash theme={null}
uv remove requests
```

### Remove multiple packages

```bash theme={null}
uv remove requests urllib3 certifi
```

### Remove a development dependency

```bash theme={null}
uv remove --dev pytest
```

### Remove from an optional dependency group

```bash theme={null}
uv remove --optional docs sphinx
```

### Remove from a custom dependency group

```bash theme={null}
uv remove --group test pytest pytest-cov
```

### Remove without syncing

```bash theme={null}
uv remove --no-sync old-package
```

This removes the package from `pyproject.toml` and updates the lockfile, but doesn't modify the environment. Run `uv sync` later to apply changes.

### Remove from a workspace package

```bash theme={null}
uv remove --package my-package requests
```

### Remove from a Python script

```bash theme={null}
uv remove --script my_script.py requests
```

Removes the dependency from the script's PEP 723 inline metadata.

### Remove with frozen lockfile

```bash theme={null}
uv remove --frozen old-package
```

Removes the package without updating the lockfile or environment.

## Common Patterns

### Clean up unused dependencies

```bash theme={null}
# Remove packages one by one
uv remove package1 package2 package3
```

### Remove all test dependencies

```bash theme={null}
uv remove --dev pytest pytest-cov pytest-mock black ruff
```

### Remove optional dependencies

```bash theme={null}
uv remove --optional docs sphinx sphinx-rtd-theme
```

### Batch removal without environment sync

```bash theme={null}
uv remove --no-sync pkg1 pkg2 pkg3
uv remove --no-sync --dev test-pkg1 test-pkg2
uv sync  # Apply all changes at once
```

## Related Commands

* [`uv add`](/cli/add) - Add dependencies to the project
* [`uv sync`](/cli/sync) - Sync the project environment
* [`uv lock`](/cli/lock) - Update the project lockfile
* [`uv tree`](/cli/tree) - Display dependency tree
