pip wheel: Build a Wheelhouse Command Reference
Pre-build wheels so later install stages are fast and offline-friendly.
pip wheel builds wheel archives (.whl) for requirements and their dependencies into a directory -- a "wheelhouse" you can install from quickly in a later CI stage.
Common flags / usage
- -w, --wheel-dir DIR -- write built wheels to DIR
- -r FILE -- build wheels for everything in a requirements file
- . -- build a wheel for the current project
- --no-deps -- build only the named project, not its dependencies
Example
shell
- run: pip wheel -w ./wheelhouse -r requirements.txt
- uses: actions/upload-artifact@v4
with:
name: wheelhouse
path: wheelhouse/
# A later job installs offline from the wheelhouse:
- run: pip install --no-index --find-links ./wheelhouse -r requirements.txtIn CI
Building a wheel from an sdist needs the project build toolchain; a missing compiler fails with errors like "gcc: No such file or directory". Install build-essential on Debian/Ubuntu runners, or prefer prebuilt wheels.
Key takeaways
- pip wheel produces .whl files for a project and all its dependencies.
- Install from a wheelhouse with pip install --no-index --find-links for fast offline installs.
- sdist builds need a compiler/toolchain on the runner.
Related guides
pip download: Fetch Distributions Command ReferenceReference for pip download in CI: fetching wheels and sdists into a directory for offline or air-gapped insta…
pip install -r requirements.txt: Command ReferenceReference for pip install -r requirements.txt in CI: installing a whole dependency file, hashed installs, con…
python -m build: Build Distributions Command ReferenceReference for python -m build in CI: producing an sdist and wheel in an isolated environment from pyproject.t…