oldest-supported-numpy Erroneously Required in Apple Silicon Python 3.10 Wheel
- Dominant language
- C++
- Stars
- 885
- Forks
- 181
- PR merge metrics
- No merged PRs in 30d
Description
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.
```bash
# 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
```
```python
# 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:
```bash
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.
Contributor guide
Research direction
Inspect the Python packaging configuration referenced in setup-macos.py and tox.ini, along with the wheel build commands in build_macos_universal2_libzfp.sh. Verify where oldest-supported-numpy is introduced, then confirm that the generated Apple Silicon wheels install without forcing an incompatible NumPy version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, numpy, python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100