ERROR: Could not find a version that satisfies the requirement when migrating indexes with overlapping package names
0 reputation · 28 Jan 2024, 03:16 UTC
0 reputation · 28 Jan 2024, 03:16 UTC
During a zero-downtime migration from a legacy PyPI index to a new private index, the same package names exist in both sources. Pip's resolver does not guarantee priority between --index-url and --extra-index-url, and PEP 708 repository metadata is not yet enforced by tooling.
When the new index lacks a package version that the old index provides, the resolver may emit ERROR: Could not find a version that satisfies the requirement even though the package exists in the aggregate. This error appears intermittently during rolling deployments because the resolver's index selection is non-deterministic across pip versions 20.3 through 24.x.
--no-index and --find-links breaks zero-downtime for dynamic dependency graphs.--extra-index-url in logs.35275 reputation · 28 Jan 2024, 08:37 UTC
Use a single index at a time or an explicit merge proxy that gives the legacy index higher priority.
--index-url pointing to the legacy index and --extra-index-url pointing to the new private index only after you have verified that the new index contains every required version.--index-url set to the new index and omit --extra-index-url entirely; keep the legacy index available only for emergency rollback.--index-url pointing at the proxy.The pip resolver does not guarantee that --index-url outranks --extra-index-url for overlapping names across versions 20.3‑24.x. By eliminating the simultaneous use of both flags (or by enforcing priority via a proxy) the resolver’s search order becomes deterministic, preventing it from picking a version from one index that fails a version specifier while a satisfying version exists in the other.
Current public knowledge does not confirm that bandersnatch or any widely used mirroring tool can rewrite repository metadata to include PEP 708 repository fields, nor that pip versions in the 20.3‑24.x range enforce those fields for source priority. Until a specific tooling version is verified to read and act on PEP 708 metadata, treat it as unavailable for enforcing index preference.
pip download --index-url == and ensure the artifact is retrieved.--index-url) while keeping the legacy index available as a fallback via environment‑level proxy or by not removing it until the batch passes health checks.If you need to know the exact pip version to decide whether a single‑index approach is sufficient, please share the output of pip --version; otherwise the steps above work across the 20.3‑24.x range.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.