Repository navigation
Description
Since #233 a requirements file whose only other index is PyTorch's (--extra-index-url https://download.pytorch.org/whl/...) is looked up on PyPI, and torch, torchvision and torchaudio are shown as unknown. PyTorch's index serves many more packages than those three. Its cu128 page lists 113 projects, among them numpy, pillow, markupsafe, jinja2, requests, triton, networkx, sympy and dozens of nvidia-* packages. The cpu page has numpy, pillow, markupsafe, jinja2, triton and requests too. The page answers all of those from PyPI as if that were certain.
It matters, because the installers don't take them from PyPI alone. pip looks at both indexes and picks the best file it finds on either of them. uv's default index strategy takes each package from the first index that has it, and an --extra-index-url comes before the default index (uv docs). So uv pip install -r requirements.txt takes numpy only from download.pytorch.org, whatever PyPI has.
A real case: keras-team/keras's requirements.txt has --extra-index-url https://download.pytorch.org/whl/cpu and -r requirements-common.txt, which lists numpy, scipy, pillow, pandas and more. deepfakes/faceswap's requirements/requirements_cpu.txt has the same line and includes numpy>=2.4.0,<2.5.0 and pillow>=12.2.0.
A second problem: every row of such a file gets lookup: false, so the page offers no fix for any of them, including packages the PyTorch index doesn't have. Run with wheelgap 0.13.0, as the worker does: a file with the PyTorch line, numpy==1.26.4 and pyyaml==6.0.3, checked for 3.15 on linux-x86_64, gives source for both, each with "lookup": false. pyyaml 6.0.4 has the wheel, but the page never says so. The cause is origin.known_pypi(), which needs source.pypi_only, and that is false for any file with an index line.
Where
PUBLIC_EXTRA_INDEXESinsite/check/driver.py:"download.pytorch.org": frozenset({"torch", "torchvision", "torchaudio"})._lookups()andcheck()in the same file:extra_pkg_hostsmarks a row unknown with itsreason.on_pypiandlookupare set fromorigin.known_pypi().renderVerdict()insite/check/check.mjsalready lists the rows that carry the reason in its "also installs from" alert.
What to do
- Replace the three names with the names the index serves: the union of the project lists on its pages (
/whl/cpu/,/whl/cu1xx/,/whl/rocm.../,/whl/xpu/), as canonical names. Keep the list indriver.py(or a JSON file beside it) with a comment saying the date it was read and how to read it again. A small script inscripts/that prints the list is welcome, but nothing at run time fetches it. - Every row whose name is on that list is unknown, with today's reason (
may be installed from download.pytorch.org, which this page doesn't read). - A row whose name isn't on the list is answered from PyPI, as now, and gets
lookup: truewhen it was found on PyPI. Its name was already sent to pypi.org for the check, so the fix lookup sends nothing new. - Keep every rule from Repo checker: a requirements.txt with PyTorch's --extra-index-url ends in "No packages were checked" #219 that keeps a file private: other hosts,
--index-url,--find-links, settings files, quotes and$in option lines.
Done when:
-
tests/test_check_driver.py: a keras-shaped file (thecpuline,-rof a file withnumpy,scipyandpillow): numpy and pillow are unknown with the reason, and scipy is checked withlookup: true. -
tests/test_check_driver.py:fixes()answers for a gap in a package the index doesn't serve (the pyyaml example above), and gives nothing for one it does. - A test that the list is canonical, sorted and holds
torch,numpyandpillow. -
test_a_private_index_package_is_never_looked_up_on_pypiand the Repo checker: a requirements.txt with PyTorch's --extra-index-url ends in "No packages were checked" #219 tests pass unchanged. - In the PR:
keras-team/kerasbefore and after, as screenshots.
Activity