Our local python package server contains these files:
subprocess32-3.2.7-cp27-cp27mu-linux_x86_64.whl
subprocess32-3.5.0-cp27-none-linux_x86_64.whl
subprocess32-3.5.0rc1-cp27-none-linux_x86_64.whl
subprocess32-3.5.0.tar.gz
subprocess32-3.5.2.tar.gz
The file subprocess32-3.5.2.tar.gz is new.
Before installing of subprocess32 was successful, since this new version exists, it fails. It fails because there is no gcc on the machine which tries to install subprocess32.
What can I do? I think there are these solutions.
But all of them don't really make me happy, since I only solve my current problem. Some weeks later, the same thing can happen again.
Is there a way to tell pip to use a wheel even if this means to take an older version?
Background: there is no explicit dependency on the new version. Pip tries to take the latest version.
I use pip version 9.0.1.
If I understand correctly, your use case is to prohibit installation from source distribution ( tar.gz
, tar.bz2
, zip
) when installing a particular package subprocess32
. Do it with
$ pip install subprocess32 --only-binary=subprocess32
The difference between --only-binary=pkgname
and --only-binary=:all:
is that in the first case, the source dists will be forbidden for pkgname
only, while the latter prohibits source dists for all packages scheduled for installation, including dependencies. Multiple packages can be selected by comma-separating their names, eg --only-binary=spam,eggs,bacon
.
Entering the --only-binary
option every time starts to annoy pretty quickly. To apply it permanently, open pip.conf
and add:
# ~/.pip/pip.conf
[global]
only-binary=subprocess32
Now issuing pip install subprocess32
will have the same effect as the above command - the latest binary wheel available for the target platform will be selected. If no binary wheels will be eligible for installation, the command will fail.
You can also force the --only-binary
option in the requirement file if you have one:
# requirements.txt
subprocess32 --only-binary=subprocess32
Now, when installing from the requirement file (via pip install -r requirements.txt
), the latest binary wheel available for the target platform will be selected.
There are currently wheels for version 3.2.7 and 3.5.0 so you can try
pip install -U subprocess32==3.2.7
or
pip install -U subprocess32==3.5.0
You can also try to disable source at all:
pip install -U --only-binary=:all: subprocess32
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.