Search code examples
pythonpython-wheel

private Python packages built by wheel got Error .whl is not a supported wheel on this platform


I wrote a C embedded python package and used the following code to build a wheel file:

  python3 setup.py bdist_wheel

In my dist folder, I find: mypackage-1.0-cp38-cp38-macosx_10_14_6_x86_64.whl

os version:10.15.7

64bit-Python version:3.8

pip3 version: 21.1.3

My first question is the version of my macosx is 10.15.7, but why the wheel built the .whl file as version 10.14.6

Then I try to install the package using below:

python3 -m pip  install dist/*

I got error as ERROR: mypackage-1.0-cp38-cp38-macosx_10_14_6_x86_64.whl is not a supported wheel on this platform.

Then I change the .whl file to "mypackage-1.0-cp38-cp38-macosx_10_15_7_x86_64.whl" and got the same error.

Does anyone what the problem is? Below is my setup.py

#!/usr/bin/env python
from setuptools import setup, Extension
import numpy as np

c_mycode = Extension(
    'c_mycode',
    sources=['c_mycode/pymycode.c',
             'c_mycode/mycode.c' ],
    include_dirs=['c_mycode', np.get_include()],
    define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_4_API_VERSION')])

setup(
    name='mypackage',
    version='1.0',
    description=(
      "a package in Python."
    ),
    setup_requires=["wheel"],
    author='xxx',
    author_email='xxx@xxx',
    license="BSD compatable (see the LICENSE file)",
    packages=['mycode'],
    ext_modules=[c_mycode]
)

Solution

  • There may be a better way, but I solved the problem by borrowing the idea from

    here

    I added a line to specify the version of the platform using

    options={'bdist_wheel':{'plat_name':'macosx_10_15_x86_64'}}