Python
Package Installation
.whl File
Programming
Coding Guide

How to install a .whl file in Python with pip

Codemia Knowledge Hub ·

To install a Python package from a .whl file, run pip install path/to/package.whl. Wheels are pre-built binary distributions, so they install faster than source distributions because there is no compilation step. They are the standard distribution format and replaced eggs as of PEP 427.

What the .whl filename tells pip

A .whl file is a ZIP archive whose name tells pip which Python version, ABI and platform it targets:

 
{package}-{version}(-{build})?-{python}-{abi}-{platform}.whl

For example:

 
numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl
ComponentValueMeaning
PackagenumpyPackage name
Version1.26.4Package version
Python tagcp312CPython 3.12
ABI tagcp312CPython 3.12 ABI
Platform tagmacosx_11_0_arm64macOS 11+ on Apple Silicon

A wheel with py3-none-any in its name is pure Python and works on any platform with any Python 3 version.

Installing a wheel step by step

1. Check your pip version

Pip 1.4+ supports wheels natively. Check and upgrade if needed:

bash
pip --version
pip install --upgrade pip

2. Install the wheel

From the directory containing the .whl file:

bash
pip install numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl

Or pass the full path from anywhere:

bash
pip install /Users/yourname/Downloads/numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl

3. Verify the installation

bash
pip show numpy
python -c "import numpy; print(numpy.__version__)"

Installing into a virtual environment

Install into a virtual environment to avoid conflicts with system Python:

bash
1# Create a virtual environment
2python -m venv myproject_env
3
4# Activate it
5# macOS/Linux:
6source myproject_env/bin/activate
7# Windows:
8myproject_env\Scripts\activate
9
10# Install the wheel
11pip install /path/to/package.whl
12
13# Verify
14pip list

Where to get .whl files

PyPI

Download wheels from PyPI for offline installation or a specific version:

bash
1# Download without installing
2pip download numpy==1.26.4 -d ./wheels/
3
4# Download for a specific platform (useful for CI)
5pip download numpy==1.26.4 \
6  --platform manylinux2014_x86_64 \
7  --python-version 312 \
8  --only-binary=:all: \
9  -d ./wheels/

Unofficial Windows binaries

For Windows packages that are hard to compile (like GDAL, rasterio, or Shapely), Christoph Gohlke's archive at https://www.lfd.uci.edu/~gohlke/pythonlibs/ historically provided pre-built wheels. The site is now archived, and many of these packages publish official wheels on PyPI.

Building your own wheel

bash
1# Build a wheel from a source package
2pip wheel /path/to/source/package/ -w ./wheels/
3
4# Build from a requirements file
5pip wheel -r requirements.txt -w ./wheels/

Installing several wheels and their dependencies

bash
1# Install all wheels in a directory
2pip install ./wheels/*.whl
3
4# Install from a directory with no internet (offline mode)
5pip install --no-index --find-links=./wheels/ numpy pandas scipy

By default pip resolves a wheel's dependencies from PyPI and installs them automatically:

bash
pip install mypackage-1.0-py3-none-any.whl
# pip will fetch dependencies from PyPI

For a fully offline install, download all dependencies first:

bash
1# Download the package and all its dependencies as wheels
2pip download numpy -d ./wheels/
3
4# Install everything offline
5pip install --no-index --find-links=./wheels/ numpy

Wheel vs. source distribution vs. egg

FeatureWheel (.whl)Source dist (.tar.gz)Egg (.egg)
FormatZIP archiveCompressed tarballZIP archive
Installation speedFast (no compilation)Slow (may compile C extensions)Fast
Build step requiredNoYes (runs setup.py)No
PEP standardPEP 427 (current)PEP 625Deprecated
Arbitrary code at installNoYes (setup.py runs)No
SecuritySaferRiskier (arbitrary code)Safer

Wheels do not execute arbitrary code during installation. Source distributions run setup.py, which can execute anything.

Matching your Python and platform tags

A wheel installs only if your environment matches its tags. To see what your pip supports:

bash
pip debug --verbose

This lists supported tags like:

 
1Compatible tags: 37
2  cp312-cp312-macosx_14_0_arm64
3  cp312-cp312-macosx_14_0_universal2
4  cp312-abi3-macosx_14_0_arm64
5  ...
6  py3-none-any

pip has no flag that skips this tag check; --force-reinstall still fails with "is not a supported wheel on this platform". Renaming the file to match your platform is the only workaround, and it is not recommended because it may cause runtime crashes.

Errors when installing a wheel

  • "is not a supported wheel on this platform". The wheel's Python version, ABI or platform tag does not match your environment, usually because it was built for a different Python version or OS. Check with pip debug --verbose.
  • "No matching distribution found". With --find-links, pip might skip the local .whl if a newer version exists on PyPI. Add --no-index to use only local files.
  • sudo pip install. This installs into the system Python and can break OS-level tools. Use a virtual environment, or pip install --user package.whl if you must install system-wide.
  • Old pip. Versions before 1.4 do not support wheels, and versions before 19.0 do not support manylinux2010 wheels. Run pip install --upgrade pip first.
  • Missing compilers on source fallback. If no wheel is available and pip builds from source, you need compilers (gcc, MSVC) and development headers. Wheels exist to avoid exactly this.
  • pip install wheel is not installing your file. The package named wheel is a build tool; installing it does not install a .whl file you downloaded.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms