In Python 2 I can install a set of packages via pip
preferring binary packages over source packages (meaning: fallback to source if binary not found) with:
(1) pip install --prefer-binary -r requirements.txt
In Python 3 I can do this with:
(2) pip3 install --only-binary=:all: -r requirements.txt
But (1) is not exactly equal to (2) since the former says:
Prefer binaries when installing; but if I don't find a binary option, then I'll go with source.
The latter says:
I will fail if no binaries are found; don't even try from source.
So, from the docs it seems that one solution could be to just manually enter each package which should be considered for source installation - meaning: the "only-binary" flag can be provided multiple times on the command line and can thus handle special-cases like that (by emptying it out, or giving specific package names to the binary packages). This answer details, to some extent, that approach: Make pip download prefer to download source-distributions (not wheels).
However, I have a large number of both types of packages so I need an automated way like the (1) approach.
Question: How can I get a similar automated behavior as (1) but in Python/pip 3?
Solution: Pip is not Python - upgrade pip to vs. 20.X and use --prefer-binary
.
now its feasible to configure that on requirements.txt
--prefer-binary
<packages>
....
https://github.com/pypa/pip/pull/7996
Solution: upgrade pip to vs. 20.X and use --prefer-binary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With