In this comprehensive guide, we'll explore the causes of the 'Is not a supported wheel on this platform'
error and provide step-by-step instructions on how to resolve it. This error typically occurs when trying to install a Python package using pip, and the package's wheel file is not compatible with your platform or Python version.
Table of Contents
- Understanding the Error
- Step-by-Step Solutions
- Solution 1: Update pip
- Solution 2: Install the Correct Wheel
- Solution 3: Install from Source
- FAQs
Understanding the Error
Before diving into the solutions, it's essential to understand why the 'Is not a supported wheel on this platform'
error occurs. This error is usually caused by one of the following issues:
- The wheel file (
.whl
) for the package you're trying to install is not compatible with your operating system or platform. - The wheel file is not compatible with your Python version.
- Your pip installation is outdated.
Now that we have a better understanding of the error, let's explore the solutions.
Step-by-Step Solutions
Solution 1: Update pip
An outdated pip installation may cause compatibility issues with wheel files. To update pip, run the following command in your terminal or command prompt:
python -m pip install --upgrade pip
After updating pip, try installing the package again. If you still encounter the error, proceed to the next solution.
Solution 2: Install the Correct Wheel
You may be trying to install a wheel file that is not compatible with your platform or Python version. In this case, you'll need to find and download the appropriate wheel file for your system.
- Visit the Python Package Index (PyPI) and search for the package you want to install.
- Navigate to the package's page and click on the "Download files" tab.
- Look for a wheel file compatible with your platform and Python version. The wheel file's name follows this convention:
{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl
- Download the correct wheel file, and install it using pip:
pip install /path/to/your/downloaded_file.whl
If you still encounter the error, proceed to the next solution.
Solution 3: Install from Source
If none of the available wheel files are compatible with your system or Python version, you can try installing the package from its source code.
- Visit the package's GitHub repository or its source code hosting platform.
- Download the source code as a ZIP archive or clone the repository using git.
- Extract the ZIP archive (if applicable) and navigate to the package's root directory.
- Run the following command to install the package from the source code:
pip install .
FAQs
1. What is a wheel file?
A wheel file is a binary package format for Python packages, with a .whl
file extension. Wheel files allow for faster and more efficient package installations compared to installing from source code.
2. How do I find my Python version?
To check your Python version, run the following command in your terminal or command prompt:
python --version
3. How do I find my platform?
To check your platform, you can use Python's platform
module:
import platform
print(platform.system())
4. Can I install multiple Python versions on my system?
Yes, you can install multiple Python versions on your system. However, you may need to manage the different versions using a tool like pyenv to avoid conflicts and ensure that packages are installed with the correct Python version.
5. Can I force pip to install a package despite the error?
It is not recommended to force pip to install a package if it's not compatible with your platform or Python version. Doing so may result in unexpected behavior or crashes. Instead, try to find a compatible wheel file or install the package from its source code.
Related: Installing packages using pip and virtual environments