uv remove: Drop a Dependency from a Project
uv remove takes a package out of pyproject.toml, re-resolves the project, and updates uv.lock.
uv remove is the inverse of uv add. It edits the manifest and lockfile so a dependency drop is recorded, not just uninstalled from the environment.
What it does
uv remove deletes the named requirement from the appropriate section of pyproject.toml, re-resolves the project, updates uv.lock, and syncs the environment so the package and its now-unused transitive dependencies are gone.
Common usage
uv remove requests
uv remove --dev pytest
uv remove --group docs sphinx
uv remove --optional plot matplotlibOptions
| Flag | What it does |
|---|---|
| --dev | Remove from the dev dependency group |
| --group <name> | Remove from a named group |
| --optional <extra> | Remove from an optional extra |
| --no-sync | Edit the manifest and lock but skip installing |
| --frozen | Edit pyproject.toml without touching uv.lock |
In CI
Like uv add, uv remove mutates pyproject.toml and uv.lock and is usually a developer action, not a pipeline step. If a job must run it, pair it with a commit or pass --frozen so the lockfile is not regenerated unexpectedly. Cache $UV_CACHE_DIR so the re-resolution reuses downloaded metadata.
Common errors in CI
"warning: The dependency <name> could not be found in dependencies" means you targeted the wrong section; add --dev, --group, or --optional to match where it actually lives. "error: No solution found when resolving dependencies" can appear if removing a package breaks a constraint another dependency needed. Remove or relax that dependent next.