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

Ouverte
#5,113 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 4 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
52/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
macos, python

Piste de recherche

Commencez par tests/requirements.txt et reproduisez la commande d’installation de virtualenv documentée sur un système MacOS basé sur ARM avec Python 3.9. Vérifiez les contraintes de SciPy et les marqueurs de plateforme, puis vérifiez que les dépendances s’installent correctement sur ARM MacOS sans modifier les sélections prévues pour les autres plateformes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
C++
Étoiles
18k
Forks
2.3k
Merge moyen
5 j 7 h
PR mergées (30 j)
53

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pybind/pybind11

Toutes les issues de pybind/pybind11

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.