移行

pip から uv への移行

ライセンスと利用条件

pip
MIT, オープンソース
uv
Apache-2.0, オープンソース
置き換えの度合い
完全な置き換え uv pip mirrors pip's commands and options.

このページは英語で書かれています。

Compatibility

The official guide moves a pip and pip-tools workflow built on requirements files to a uv project. pyproject.toml takes the place of requirements.in, and uv.lock takes the place of requirements.txt. The lockfile format is specific to uv. It can hold any number of dependency groups, and it is always universal, so one file covers every platform where pip needs a lock file per platform.

The guide does not cover moving to uv’s drop-in uv pip interface, or starting from a workflow that already uses a pyproject.toml. Astral tracks both in issue #5200.

Before you switch

  1. Create a pyproject.toml with uv init if the project has none.
  2. Import the requirements with uv add -r requirements.in -c requirements.txt. Passing the old lock file as constraints keeps the versions you already run.
  3. Import development requirements into the dev group with uv add --dev -r requirements-dev.in -c requirements-dev.txt, and any other set into a named group with --group, for example --group docs.
  4. Run commands with uv run, for example uv run pytest, or create the environment with uv sync. uv keeps a .venv directory per project and syncs it for you.

Local paths, editable paths and Git dependencies in requirements.in end up in the [tool.uv.sources] table of pyproject.toml.

Pitfalls

公式ガイド

uvの移行ガイド ↗

2026-09-29にレビュー済み。

出典

pipのその他の代替 →