Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4862 pages

Upgrades and deprecations

Migrate from pip and Poetry to uv: pick the route before the commands

In short

To migrate from pip and Poetry to uv, pick one of two routes first. The pip interface keeps your requirements files and swaps the installer with uv venv, uv pip compile and uv pip sync. The project route moves dependencies into pyproject.toml and one universal uv.lock with uv init, uv add and uv sync. uv's docs have a migration guide for pip users only.

Two routes to migrate from pip and Poetry to uv

uv gives you two separate front ends. The uv pip commands behave like pip and pip-tools, so scripts, Dockerfiles and requirements files stay where they are. The project commands (uv init, uv add, uv lock, uv sync, uv run) manage a pyproject.toml and write uv.lock, which uv describes as a universal lockfile covering platforms, architectures and Python versions.

The table sums up what each route changes, using only what uv's pages say. I read them on 29 November 2026; uv ships often, so check the version you install against the same pages.

QuestionRoute 1: pip interfaceRoute 2: uv project
Files you keep`requirements.in` and pinned `requirements.txt` (or `pylock.toml`)`pyproject.toml` plus `uv.lock`; the pinned file goes away
Main commands`uv venv`, `uv pip compile -o`, `uv pip sync`, `uv pip install``uv init`, `uv add`, `uv lock`, `uv sync`, `uv run`
One lock for every platformOnly with `uv pip compile --universal`Always; `uv.lock` is universal
Which environment it touchesActive venv, Conda env, or `.venv` in this or a parent folderThe project's `.venv`; an active `VIRTUAL_ENV` is ignored unless you pass `--active`
Official migration guideNot yet writtenYes, from pip and requirements files

Checked against: source 1, source 2, source 3, source 6, source 7

Route one: keep requirements files and swap pip for uv pip

This is the smaller change, close in spirit to the hyphen swap in the Compose V1 to V2 move. Create the environment with uv venv, which makes .venv and can fetch a Python version you do not have. uv then finds that .venv by itself on later commands. Unlike pip, it refuses to install into a Python outside a virtual environment unless you pass --system or --python. If your old setup fought the system Python on Debian or Ubuntu, the externally managed environment error explains why a venv is the clean answer there too.

For pinning, uv pip compile requirements.in -o requirements.txt replaces pip-compile. The output flag is required for a file; without it the result only prints. Existing pins are kept on later runs until you pass --upgrade or --upgrade-package name. Then uv pip sync requirements.txt makes the environment match the file exactly, while uv pip install leaves extra packages in place.

uv venv
uv pip compile requirements.in -o requirements.txt
uv pip sync requirements.txt

Checked against: source 3, source 4, source 2

Pip compatibility differences to check after the switch

uv publishes a pip compatibility page, and these rows are the ones I would read before switching a CI job or a Docker build. Each one can change what gets installed without any error.

The index row matters most if you mix a private index with PyPI. uv offers unsafe-best-match to behave closest to pip, and the docs name the risk in the option itself: dependency confusion.

Areapipuv pip
Config filesReads `pip.conf` and `PIP_INDEX_URL`Ignores them; use `UV_INDEX_URL`, `uv.toml` or `[tool.uv.pip]`
Several indexesMerges candidates from all indexesStops at the first index that has the package (`first-index`)
BytecodeCompiles `.pyc` files on installSkips it unless `--compile-bytecode` or `UV_COMPILE_BYTECODE=1`
`--user` installsSupportedNot supported
Pre-releasesVaried before pip 26.0`if-necessary` by default
Compiled requirementsNo compile command in pip itself`uv pip compile` needs `-o`, strips extras unless `--no-strip-extras`, omits index URLs unless `--emit-index-url`
Constraints and builds`PIP_CONSTRAINT` reaches build dependenciesNeeds `--build-constraint` for build dependencies
Package names in outputPublished spellingNormalized, for example `docstring-parser`

Checked against: source 1, source 4

Route two: move a requirements.txt project into uv.lock

The official guide keeps your current versions by feeding the old pinned file in as constraints. Without -c, uv solves for newer versions. The steps, in the guide's order:

  • Run uv init to create pyproject.toml.
  • Run uv add -r requirements.in -c requirements.txt for the main dependencies.
  • Run uv add --dev -r requirements-dev.in -c requirements-dev.txt for development tools. If that file pulls in the base file with -r, strip those lines first so base packages do not land in the dev group.
  • Use --group docs (or another name) for further groups; uv writes them to [dependency-groups], and the dev group is synced by default.
  • Run uv sync, then run commands through uv run, which checks that the lock matches pyproject.toml before each run.
  • Commit uv.lock. It is readable TOML, but uv manages it, so do not edit it by hand.
  • If you kept one pinned file per platform, the guide says to regenerate each with markers using uv pip compile --python-platform and --no-strip-markers before passing them with -c, because plain per-platform pins conflict with a universal lock. Git and local path requirements move into [tool.uv.sources], which only uv reads.

Checked against: source 2, source 7, source 8

Moving a Poetry project to uv: what the docs cover

uv's migration index says guides for other project tools are not yet available, so there is no official Poetry route to follow. What the two projects' own pages do say helps plan it.

Poetry's pyproject documentation tells Poetry 2.0 users to consider the standard project.dependencies section, and it marks fields like name, authors and extras under [tool.poetry] as deprecated in favour of [project]. uv reads project.dependencies too. Poetry dependency groups still live in [tool.poetry.group.<name>.dependencies], while uv keeps local groups in [dependency-groups], so groups need moving by hand. Private sources in [[tool.poetry.source]] have no direct uv match on those pages.

My order would be: get the runtime list into [project], move each group with uv add --group, lock, then compare the resolved versions with what production runs before deleting poetry.lock. If CI still calls Poetry during the move, Poetry missing on GitHub Actions covers that failure.

Checked against: source 5, source 6, source 8

Scripts and command line tools: PEP 723 metadata and uvx

Single scripts do not need a project. uv init --script example.py --python 3.12 writes an inline metadata block at the top of the file, uv add --script example.py 'requests<3' adds to it, and uv run example.py builds a temporary environment from it. The dependencies field must be present even when empty. uv lock --script example.py writes example.py.lock beside the script, and an exclude-newer timestamp in [tool.uv] limits uv to releases before that date.

Tools you used to install with pipx run through uvx, an alias for uv tool run that uses a throwaway isolated environment. uv tool install keeps one on your PATH. Pin a version with ruff@0.3.0 or --from 'ruff==0.3.0'. The docs make one exception: tools that need your project installed, such as pytest or mypy, belong under uv run instead.

Checked against: source 9, source 10

Pin uv and Python so the migration stays reproducible

The GitHub Actions guide calls pinning a specific uv version best practice and shows the version input on astral-sh/setup-uv, with 0.13.10 as its example. The standalone installer takes a version in its URL in the same way. Python itself is pinned with uv python pin, which writes .python-version; uv python install with no arguments then installs that version. uv downloads Python by default when none is found, and the list of available versions is frozen per uv release, so a newer Python can need a newer uv.

For the lock, uv lock --check fails when the lock no longer matches the project metadata, and --locked raises an error instead of updating the lock. --frozen uses the lock without checking it. The guide's CI example installs with uv sync --locked --all-extras --dev. When that step complains inside a container, see uv sync with a stale lock in Docker.

If the move happens together with a Python bump, read the Python 3.9 to 3.12 upgrade order first, and change one thing per release. Other toolchain moves in this series, like the Node.js annual release schedule, follow the same rule: pin the tool, then upgrade on purpose. More routes like this are listed on the upgrades hub.

- name: Install uv
  uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
  with:
    version: "0.13.10"
- run: uv python install
- run: uv sync --locked --all-extras --dev

Checked against: source 11, source 12, source 13, source 14

What else do people ask?

Is uv a drop-in replacement for pip?

For most commands the uv pip interface works the same way, but uv's compatibility page lists real differences: it needs a virtual environment by default, ignores pip.conf, stops at the first matching index and skips bytecode compilation.

What replaces poetry.lock or requirements.txt after a uv migration?

uv.lock, a uv-specific universal lockfile you commit to version control. If another tool needs a standard file, uv export -o pylock.toml produces one from it.

Can I migrate from pip to uv without a pyproject.toml?

Yes. Route one keeps requirements.in and requirements.txt and only changes the commands to uv pip compile and uv pip sync.

Does uv have an official Poetry migration guide?

Not when these pages were read on 29 November 2026. uv's migration index lists only the pip to project guide and says guides for other project tools are not yet available.

Does uv install Python for me during a migration?

By default, yes: uv downloads a managed Python when it cannot find a suitable one. Set python-downloads to manual, or pass --no-python-downloads, if build machines must use the system Python.

Should CI use uv sync --locked or --frozen?

--locked stops with an error when the lock is out of date, which catches a forgotten uv lock. --frozen skips that check and installs from the lock as it is.

Sources

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.