pybind / pybind11

Seamless operability between C++11 and Python

Home Page:https://pybind11.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: `tests/requirements.txt` not working on ARM-based MacOS

JCGoran opened this issue · comments

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

19a6b9f

Problem description

I tried following the installation instructions as written here on an ARM-based MacOS, and I didn't get very far since tests/requirements.txt doesn't seem to work (the below is in a venv):

$ python -V
Python 3.9.19
$ python -m pip -V
pip 24.0 from /pybind11/venv/lib/python3.9/site-packages/pip (python 3.9)
$ python -m pip install -r tests/requirements.txt --no-cache-dir
Ignoring build: markers 'python_version == "3.6"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7" and platform_python_implementation == "PyPy"' don't match your environment
Ignoring numpy: markers 'python_version == "3.8" and platform_python_implementation == "PyPy"' don't match your environment
Ignoring numpy: markers 'python_version == "3.9" and platform_python_implementation == "PyPy"' don't match your environment
Ignoring numpy: markers 'platform_python_implementation != "PyPy" and python_version == "3.6"' don't match your environment
Ignoring numpy: markers 'platform_python_implementation != "PyPy" and python_version == "3.10"' don't match your environment
Ignoring numpy: markers 'platform_python_implementation != "PyPy" and python_version >= "3.11" and python_version < "3.13"' don't match your environment
Ignoring scipy: markers 'platform_python_implementation != "PyPy" and python_version == "3.10"' don't match your environment
Ignoring scipy: markers 'platform_python_implementation != "PyPy" and python_version >= "3.11" and python_version < "3.13"' don't match your environment
Collecting build~=1.0 (from -r tests/requirements.txt (line 3))
  Downloading build-1.2.1-py3-none-any.whl.metadata (4.3 kB)
Collecting numpy~=1.21.5 (from -r tests/requirements.txt (line 8))
  Downloading numpy-1.21.6-cp39-cp39-macosx_11_0_arm64.whl.metadata (2.1 kB)
Collecting pytest~=7.0 (from -r tests/requirements.txt (line 11))
  Downloading pytest-7.4.4-py3-none-any.whl.metadata (7.9 kB)
Collecting pytest-timeout (from -r tests/requirements.txt (line 12))
  Downloading pytest_timeout-2.3.1-py3-none-any.whl.metadata (20 kB)
ERROR: Ignored the following yanked versions: 1.11.0
ERROR: Could not find a version that satisfies the requirement scipy~=1.5.4 (from versions: 1.7.3, 1.8.0rc1, 1.8.0rc2, 1.8.0rc3, 1.8.0rc4, 1.8.0, 1.8.1, 1.9.0rc1, 1.9.0rc2, 1.9.0rc3, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0rc1, 1.10.0rc2, 1.10.0, 1.10.1, 1.11.0rc1, 1.11.0rc2, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.13.0rc1, 1.13.0)
ERROR: No matching distribution found for scipy~=1.5.4

The problem is caused by the --only-binary=:all: header, as scipy 1.5.4 is not available as a wheel for ARM-based MacOS. Note that installation of scipy from source also fails, but that's expected since the ARM-based Macs only came out around the same time as that scipy version.

As a workaround, the following diff seems to work (the specific version of scipy was found by looking at the changelog):

diff --git a/tests/requirements.txt b/tests/requirements.txt
index e056c6fa..0c80edc9 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -10,6 +10,7 @@ numpy~=1.22.2; platform_python_implementation!="PyPy" and python_version=="3.10"
 numpy~=1.26.0; platform_python_implementation!="PyPy" and python_version>="3.11" and python_version<"3.13"
 pytest~=7.0
 pytest-timeout
-scipy~=1.5.4; platform_python_implementation!="PyPy" and python_version<"3.10"
+scipy~=1.7.3; platform_python_implementation!="PyPy" and python_version<"3.10" and platform_system=="Darwin" and platform_machine=="arm64"
+scipy~=1.5.4; platform_python_implementation!="PyPy" and python_version<"3.10" and platform_machine!="arm64"
 scipy~=1.8.0; platform_python_implementation!="PyPy" and python_version=="3.10"
 scipy~=1.11.1; platform_python_implementation!="PyPy" and python_version>="3.11" and python_version<"3.13"

Reproducible example code

python3.9 -m venv venv && source venv/bin/activate && python -m pip install -r tests/requirements.txt --no-cache-dir

Is this a regression? Put the last known working version here if it is.

Not a regression