[BUG]: `tests/requirements.txt` not working on ARM-based MacOS
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Required prerequisites
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker and Discussions to verify that this hasn't already been reported. +1 or comment there if it has.
- Consider asking first in the Gitter chat room or in a Discussion.
What version (or hash if on master) of pybind11 are you using?
19a6b9f4efb569129c878b7f8db09132248fbaa1
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/requirements.txt and reproduce the documented virtualenv installation command on an ARM-based MacOS system using Python 3.9. Check the SciPy constraints and platform markers, then verify that the requirements install successfully on ARM MacOS without changing the intended selections for other platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, python
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100