Skip to main content
Remove dependencies from the project’s pyproject.toml.

Usage

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

PACKAGES
string[]
required
The names of the dependencies to remove (e.g., ruff).Packages are specified by name, not as full PEP 508 requirements.

Options

Dependency Groups

--dev
Remove the packages from the development dependency group.This option is an alias for --group dev.Environment variable: UV_DEV
--optional
string
Remove the packages from the project’s optional dependencies for the specified extra.
--group
string
Remove the packages from the specified dependency group.

Syncing Options

--no-sync
Avoid syncing the virtual environment after re-locking the project.Environment variable: UV_NO_SYNC

Locking Options

--locked
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
--frozen
Remove dependencies without re-locking the project.The project environment will not be synced.Environment variable: UV_FROZEN

Workspace Options

--package
string
Remove the dependencies from a specific package in the workspace.
--script
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.

Environment Options

--active
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.
--python
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

Examples

Remove a single package

Remove multiple packages

Remove a development dependency

Remove from an optional dependency group

Remove from a custom dependency group

Remove without syncing

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

Remove from a Python script

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

Remove with frozen lockfile

Removes the package without updating the lockfile or environment.

Common Patterns

Clean up unused dependencies

Remove all test dependencies

Remove optional dependencies

Batch removal without environment sync

  • uv add - Add dependencies to the project
  • uv sync - Sync the project environment
  • uv lock - Update the project lockfile
  • uv tree - Display dependency tree