How to Resolve Python "ERROR: *.whl is not a supported wheel on this platform"
When installing Python packages from local .whl
(wheel) files using pip
, you might encounter the error: ERROR: filename.whl is not a supported wheel on this platform
. This message indicates that pip
has determined the specific wheel file you're trying to install is incompatible with your current Python interpreter setup (considering factors like Python version, operating system, and CPU architecture).
This guide explains the common reasons for this incompatibility and provides systematic steps to diagnose the issue and find the correct wheel file.
Understanding the Error: Wheel Files and Compatibility Tags
A wheel (.whl
) file is a pre-built Python package distribution format. It often contains compiled code, making installation faster than building from source. Crucially, wheel filenames embed compatibility tags that specify the environments the wheel is built for. These tags typically include:
- Python Implementation & Version: e.g.,
cp310
(CPython 3.10),py3
(Python 3 generic). - ABI (Application Binary Interface): e.g.,
cp310m
(specific CPython ABI). - Platform/Architecture: e.g.,
win_amd64
(Windows 64-bit),win32
(Windows 32-bit),manylinux_x86_64
(many Linux distros, 64-bit),macosx_x86_64
(macOS Intel 64-bit),macosx_arm64
(macOS Apple Silicon).
When you run pip install filename.whl
, pip
reads these tags from the filename and compares them against the tags supported by your current Python environment. If there's no match, pip
concludes the wheel is not supported and raises the error.
Common Causes of Incompatibility
- Architecture Mismatch: Trying to install a 32-bit wheel (
win32
) on a 64-bit Python installation (win_amd64
), or vice-versa. - Python Version Mismatch: Trying to install a wheel built for a different Python version (e.g.,
cp39
wheel with a Python 3.10 interpreter). - Operating System Mismatch: Trying to install a Windows wheel (
win_amd64
) on Linux or macOS. - Incorrect Filename: The wheel filename might be corrupted or altered (e.g.,
(1)
added by browser downloads), preventingpip
from parsing the tags correctly. - Outdated
pip
: An oldpip
version might not recognize newer compatibility tags used by the wheel file.
Solution Step 1: Check Your Python Environment
Before downloading a wheel, you must know the specifics of the Python environment you intend to install into.
Check Python Version
Open your terminal or command prompt (activate your virtual environment if using one) and run:
python --version
# Or potentially:
# python3 --version
# py --version # Windows
Note the major and minor version (e.g., 3.10
).
Check Python Architecture (32-bit vs 64-bit)
Run this command:
python -c "import sys; print('64-bit' if sys.maxsize > 2**32 else '32-bit')"
# Or potentially:
# python3 -c "..."
# py -c "..." # Windows
This will output either 64-bit
or 32-bit
.
Check Supported Platform Tags (pip debug --verbose
)
This is a crucial step. Run pip debug
to see exactly which tags your installation supports.
pip debug --verbose
# Or potentially:
# python -m pip debug --verbose
# python3 -m pip debug --verbose
Look for the Compatible tags
section in the output. It will list many combinations like cp310-cp310-win_amd64
, cp310-abi3-win_amd64
, py3-none-win_amd64
, cp310-none-any
, py3-none-any
, etc. Your wheel file's tags must match at least one of these supported tags.
Solution Step 2: Find and Download the Correct Wheel File
Understanding Wheel Filename Tags
A typical wheel filename looks like this:
{distribution}-{version}-{python_tag}-{abi_tag}-{platform_tag}.whl
Example: numpy-1.23.5-cp310-cp310-win_amd64.whl
numpy
: Package name1.23.5
: Package versioncp310
: Python tag (CPython 3.10)cp310
: ABI tagwin_amd64
: Platform tag (Windows 64-bit)
Example: requests-2.28.1-py3-none-any.whl
requests
: Package name2.28.1
: Package versionpy3
: Python tag (Works on any Python 3+)none
: ABI tag (No specific ABI needed)any
: Platform tag (Works on any platform) - These are "pure Python" wheels.
Matching Wheel Tags to Your Environment
Compare the tags from the wheel filename you want to download with the "Compatible tags" list from pip debug --verbose
.
- The Python tag (like
cp310
) must match your interpreter version. - The Platform tag (like
win_amd64
,manylinux_x86_64
) must match your OS and architecture. - Wheels tagged
py3-none-any
are generally compatible with any Python 3 on any platform.
Where to Find Wheel Files
- PyPI (Python Package Index): Usually the primary source.
pip install package_name
tries to find a compatible wheel here automatically. If it fails, you might manually browse the "Download files" section for the package onpypi.org
. - Unofficial Windows Binaries (Christoph Gohlke): A well-known resource (https://www.lfd.uci.edu/~gohlke/pythonlibs/) for pre-compiled Windows wheels, especially for scientific packages that can be tricky to build. Carefully match the tags here to your environment.
- Project Releases: Some projects might offer wheels directly on their GitHub Releases page or website.
Download the wheel file whose tags explicitly match your environment.
Solution Step 3: Ensure Correct Filename
Sometimes, downloading a file multiple times adds (1)
or similar suffixes. pip
cannot parse these filenames correctly.
- Incorrect:
numpy‑1.23.5‑cp310‑cp310‑win_amd64 (1).whl
- Correct:
numpy‑1.23.5‑cp310‑cp310‑win_amd64.whl
Rename the downloaded file to remove any extra characters added by your browser or OS, ensuring it matches the standard wheel naming convention.
Solution Step 4: Upgrade pip
An outdated pip
might not recognize newer tag formats or have bugs related to tag resolution.
# Upgrade pip
python -m pip install --upgrade pip
# Or potentially:
# python3 -m pip install --upgrade pip
# py -m pip install --upgrade pip # Windows
After upgrading pip
, try the installation again.
Step-by-Step Example: Installing a Compatible Wheel
Let's say you need numpy
and your checks revealed:
- Python Version: 3.10
- Architecture: 64-bit
- OS: Windows (
pip debug
showswin_amd64
tags are supported)
- Go to a source like Gohlke's site or PyPI.
- Find the
numpy
section. - Locate the wheel file with tags matching your environment. You'd look for
cp310
(Python 3.10) andwin_amd64
(Windows 64-bit). Example:numpy‑1.23.5‑cp310‑cp310‑win_amd64.whl
. - Download that specific file.
- Ensure the filename is correct (no extra
(1)
etc.). - Open your terminal/command prompt in the directory where you downloaded the file.
- Activate your virtual environment if applicable.
- Run the install command:
pip install numpy-1.23.5-cp310-cp310-win_amd64.whl
# Or:
python -m pip install numpy-1.23.5-cp310-cp310-win_amd64.whl
A Note on Renaming Wheel Files (Use with Extreme Caution)
Renaming wheel files to "trick" pip (e.g., changing cp39
to cp310
or win32
to win_amd64
) is generally a bad idea and should be avoided.
- Why it's bad: Wheel files often contain compiled C extensions specific to the Python version and architecture they were built for. Renaming the file doesn't change the compiled code inside. Installing a mismatched wheel might seem to work initially but can lead to subtle runtime errors, crashes, or incorrect results later on because the compiled code is incompatible with your interpreter.
- When it might seem okay (but still risky): For pure Python wheels (
py3-none-any
), renaming might not cause immediate harm, but it defeats the purpose of the tagging system. Sometimes, minor Python version differences (e.g., 3.10.1 vs 3.10.5) might be compatible, but relying on renaming is fragile. - Recommendation: Always find and download the wheel file that correctly matches your environment's tags. Do not rely on renaming as a solution.
Conclusion
The ERROR: filename.whl is not a supported wheel on this platform
means pip
detected an incompatibility between the wheel file's compatibility tags and your current Python environment.
To fix this:
- Identify your environment: Check your Python version (e.g., 3.10) and architecture (32/64-bit).
- Check supported tags: Use
pip debug --verbose
to see exactly what tags your environment supports. - Find the matching wheel: Locate and download the
.whl
file whose embedded tags (Python version, platform, architecture) match one of the tags supported by your environment. - Verify the filename: Ensure the downloaded filename is correct and hasn't been altered.
- Keep
pip
updated: Runpython -m pip install --upgrade pip
.
By carefully matching the wheel file to your specific platform, you can ensure successful installations. Avoid renaming wheel files to force compatibility, as this can lead to hidden runtime issues.