25

pip download has several flags that I would like to play with --platform, --abi, and --implementation.

Where can I find the complete list of valid values for these flags?

not2qubit
  • 14,531
  • 8
  • 95
  • 135
ericg
  • 8,413
  • 9
  • 43
  • 77

3 Answers3

15

I don't think there is one definitive list. You have to collect it from different sources. Start with PEP 425: https://www.python.org/dev/peps/pep-0425/

python tag: ‘py27’, ‘cp33’

abi tag: ‘cp32dmu’, ‘none’

platform tag: ‘linux_x86_64’, ‘any’

--implementation:

cp: CPython
ip: IronPython
pp: PyPy
jy: Jython

--platform:

win32
linux_i386
linux_x86_64
phd
  • 82,685
  • 13
  • 120
  • 165
  • 6
    That contains some of the information, but not all. There are extensions like https://www.python.org/dev/peps/pep-0513/ ... I am looking for the complete list. – ericg Apr 05 '18 at 13:55
  • You're not really saying anything what the different `--implementation` options mean or what they do. – not2qubit Oct 15 '19 at 20:48
  • 2
    One of the most important `--platform` tags these days, missing from the original 2012 PEP is `manylinux1_x86_64`. I also see `manylinux1_i686`. There were the `--abi` tags `cp27m` and `cp27mu` for python 2 to distinguish between ucs2 and ucs4 unicode build flags. Those are no longer relevant in python 3 though. Use the new `pip debug` feature added in v19.2 to see more tag related info. Relevant github [issue](https://github.com/pypa/pip/issues/6121). – Amit Naidu May 28 '20 at 06:38
  • After I skimmed through in the link that @ericg provided and some trial and error, I was able to grab .whl files for Windows using a macOS computer. By entering `python -m pip download -r requirements.txt -d ../packages --platform win32 --only-binary=:all:`, I got all the files I needed for Windows :) Thanks for the leads guys! – W1ck3d Feb 23 '22 at 06:09
6

If you are only downloading a single package, you could go to https://pypi.org and search for what's available.

E.g. for orjson https://pypi.org/project/orjson/3.8.2/#files, you can see there's things like:

  • win_amd64
  • manylinux_2_28_x86_64
  • manylinux_2_28_aarch64
  • manylinux_2_17_x86_64
  • manylinux2014_x86_64
  • manylinux_2_17_armv7l
  • manylinux2014_armv7l
  • manylinux_2_17_aarch64
  • manylinux2014_aarch64
  • macosx_10_9_x86_64
  • macosx_11_0_arm64
  • macosx_10_9_universal2
  • macosx_10_7_x86_64

If you're curious what manylinux means, refer to this: https://github.com/pypa/manylinux

The manylinux_x_y refers to glibc versions, observed when you run ldd --version in your shell. glibc is backwards compatible, so pick a version equal to or below your current glibc version.

Cardin
  • 5,148
  • 5
  • 36
  • 37
5

If you have access to the PC (or similar platform) for which you need to download the package, per the documentation, the following function can be called to get the explicit platform name.

distutils.util.get_platform()

The platform tag is simply distutils.util.get_platform() with all hyphens - and periods . replaced with underscore _.


In our case, we have offline PCs (which must remain offline); so this approach works perfectly to ensure we download the correct platform for those PCs.

S3DEV
  • 8,768
  • 3
  • 31
  • 42