Feature request: use --hash to match correct file #6395
Labels
auto-locked
Outdated issues that have been locked by automation
resolution: duplicate
Duplicate of an existing issue/PR
What's the problem this feature will solve?
When a package includes hashes for their dependencies, and the user is using a third-party repo as their additional index, pip may choose to use a file from the additional index rather than PyPI (e.g. if the third party provides a wheel and PyPI doesn't), in which case the hash will not match and the installation will fail. If a matching hash is required, and the file with the required hash is available, this file should take priority even if it is usually of lower presedence to pip (i.e. bdist vs sdist).
Describe the solution you'd like
I suggest that when a hash is specified, pip should only attempt to install a file with a matching hash, even when alternative otherwise suitable files are available.
Scenario:
(using 6-character hashes for brevity)
package-1.0.0-none-any.whl
with hashabcdef
package-1.0.0.tar.gz
with hashbeefed
Example (current):
Example (proposed):
Alternative Solutions
Related to #6394 but a different problem.
Additional context
I maintain a third-party repo at piwheels.org for Raspberry Pi users and we pre-configure
/etc/pip.conf
in Raspbian to setextra-index-url
. If users want to make sure their installation comes from PyPI to match the hash, they have to remove/etc/pip.conf
. But it's not obvious that's the case.See piwheels/piwheels#144
The text was updated successfully, but these errors were encountered: