Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does pip decide which many linux wheel to use?

Binary many-linux wheels are now supported:

https://github.com/pypa/manylinux

Specifically I would like to install the many linux wheel for scipy on Travis, using the trusty beta operating system. The wheels are listed here:

https://pypi.python.org/pypi/scipy/0.17.1

I get:

Collecting scipy
  Downloading scipy-0.17.1.tar.gz (12.4MB)
    100% |████████████████████████████████| 12.4MB 100kB/s 

Instead of:

Collecting scipy
  Downloading scipy-0.17.1-cp27-cp27mu-manylinux1_x86_64.whl (39.5MB)
    100% |████████████████████████████████| 39.5MB 37kB/s 

So, in order to fix this, I would like to know, how pip determines which wheel to download and install. And yes, I did update pip to version 8.1.2 which supports binary many linux wheels.

Specifically, I am not interested in alternative solutions, just answer the question, if you can.

like image 217
esc Avatar asked Jun 13 '16 14:06

esc


People also ask

What does pip wheel do?

If you've installed a Python package using pip , then chances are that a wheel has made the installation faster and more efficient. Wheels are a component of the Python ecosystem that helps to make package installs just work. They allow for faster installations and more stability in the package distribution process.

Do Python wheels contain dependencies?

Python package installed with pip , e.g. WheelPython dependencies can be specified as dependencies in your packaging, and automatically installed by pip . You can include third party C libraries in wheels, but for sufficiently complex dependencies that won't work.

What are wheel files in Python?

A built-package format for Python. A wheel is a ZIP-format archive with a specially formatted filename and the . whl extension. It is designed to contain all the files for a PEP 376 compatible install in a way that is very close to the on-disk format.


2 Answers

You need pip 8.1 or later and a linux distribution that is based on glibc (and not musl libc as alpine linux for instance).

EDIT: the function pip._internal.utils.compatibility_tags.get_supported() should return the list of supported platform tags in order. Pip prefers wheel tags that appear earlier in this list over tags that appear later.

Also may I kindly suggest you to use python 3.5 instead of 2.7 ;)

like image 54
ogrisel Avatar answered Sep 28 '22 03:09

ogrisel


Since pip version 19.3, TargetPython.get_tags() returns the supported PEP 425 tags to check wheel candidates against (source). The tags are returned in order of preference (most preferred first).

from pip._internal.models.target_python import TargetPython
target_python = TargetPython()
pep425tags = target_python.get_tags()

The class TargetPython encapsulates the properties of a Python interpreter one is targeting for a package install, download, etc.

like image 42
gdlmx Avatar answered Sep 28 '22 03:09

gdlmx