Skip to content

oldest-supported-numpy Erroneously Required in Apple Silicon Python 3.10 Wheel #201

@william-silversmith

Description

@william-silversmith

Hi zfpy team,

Thanks again for uploading my wheels! I was attempting to use them and ran into an issue that I found was my own doing. During the wheel compilation, I had added install_requires=['oldest-supported-numpy', 'cython'] to setup.py while I was experimenting, but forgot to remove it. This is causing a version conflict with some other software I am using that requires a newer version of numpy. I'm happy to produce a set of fixed wheels if that would be okay. I've developed a superior build process since I last tried this.

# build_macos_universal2_libzfp.sh
#!/usr/bin/sh

ARMDIR=build_macos/arm64
X86DIR=build_macos/x86_64

mkdir -p $ARMDIR
mkdir -p $X86DIR

cmake -B $ARMDIR -S . -DCMAKE_OSX_ARCHITECTURES=arm64 -DBUILD_TESTING=NO -DBUILD_SHARED_LIBS=OFF
cmake -B $X86DIR -S . -DCMAKE_OSX_ARCHITECTURES=x86_64 -DBUILD_TESTING=NO -DBUILD_SHARED_LIBS=OFF

DIR=$(pwd)
cd $DIR/$ARMDIR && make
cd $DIR/$X86DIR && make

lipo -create -output $DIR/libzfp.a $DIR/$ARMDIR/lib/libzfp.a $DIR/$X86DIR/lib/libzfp.a
# setup-macos.py
from setuptools import setup, Extension

class NumpyImport:
  def __repr__(self):
    import numpy as np

    return np.get_include()

  __fspath__ = __repr__

setup(
    name="zfpy",
    version="1.0.0",
    author="Peter Lindstrom",
    author_email="zfp@llnl.gov",
    url="https://zfp.llnl.gov",
    description="zfp compression in Python",
    long_description="zfp is a compressed format for representing multidimensional floating-point and integer arrays. zfp provides compressed-array classes that support high throughput read and write random access to individual array elements. zfp also supports serial and parallel compression of whole arrays using both lossless and lossy compression with error tolerances. zfp is primarily written in C and C++ but also includes Python and Fortran bindings.",
    ext_modules=[
        Extension("zfpy", ["python/zfpy.pyx"],
            include_dirs=["include", NumpyImport()],
            library_dirs=['/Users/wms/code/zfp/'],
            libraries=["zfp"]
        )
    ]
)
# tox.ini
[tox]
envlist = py38,py39,py310,py311

[testenv]
platform = darwin
deps = 
	oldest-supported-numpy
	cython

commands = 
	python setup.py bdist_wheel

To actually build the wheels:

sh ./build_macos_universal2_libzfp.sh
tox

The key difference here from my previous build process is that I have finally figured out how to get tox to run on setup.py files that require numpy. This ensures a clean build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions