Skip to content
Latchkey

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 numpy

Common 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 numpy

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →