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

Offen
#5,113 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 4 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
52/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
macos, python

Rechercherichtung

Beginne mit tests/requirements.txt und reproduziere den dokumentierten virtualenv-Installationsbefehl auf einem ARM-basierten MacOS-System mit Python 3.9. Überprüfe die SciPy-Einschränkungen und Plattformmarker und verifiziere anschließend, dass die Anforderungen unter ARM MacOS erfolgreich installiert werden, ohne die vorgesehenen Auswahlen für andere Plattformen zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

triage
Required prerequisites
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

Vorherrschende Sprache
C++
Sterne
18k
Forks
2.3k
Ø Merge
5 T. 7 Std.
Gemergte PRs (30 T.)
53

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pybind/pybind11

Alle Issues in pybind/pybind11

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.