pip download: Fetch Packages Without Installing
Download distributions for offline installs without touching the environment.
pip download fetches packages and their dependencies into a directory without installing them - the basis for offline and air-gapped CI installs.
What it does
Resolves dependencies and downloads matching distributions (wheels and/or sdists) into a directory. You can target a different platform and Python version than the host.
Common usage
Terminal
pip download -d ./wheels requests
pip download -d ./wheels -r requirements.txt
pip download --only-binary=:all: \
--platform manylinux2014_x86_64 \
--python-version 311 \
-d ./wheels numpyCommon CI error: sdist build when cross-targeting
When you pass --platform or --python-version, pip cannot build source distributions, so it errors unless every dependency has a matching wheel. Add --only-binary=:all: and ensure wheels exist.
Terminal
# Failure:
# ERROR: When restricting platform and interpreter
# version, you must only download wheels.
# Fix:
pip download --only-binary=:all: \
--platform manylinux2014_x86_64 \
--python-version 311 -d ./wheels numpyRelated guides
pip install --only-binary: Force Wheels, Skip BuildsHow pip install --only-binary forces wheel-only installs to avoid slow, fragile source builds in CI, the :all…
pip wheel: Build Wheels for Your DependenciesHow pip wheel builds wheel archives for a project and its dependencies, why CI uses it to pre-build a wheelho…
pip install -r: Install from requirements.txt in CIHow pip install -r installs every dependency from a requirements file, the flags that make it reproducible in…