From 8117a4b9a6caa95627ed40e8e1920da4ac0874ff Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Wed, 18 Oct 2023 11:44:24 -0600 Subject: [PATCH] MAINT: NumPy normalize_axis_tuple * this function moved from NumPy core to the public API in recent NumPy builds, and is causing SciPy CI failures here: https://github.com/scipy/scipy/actions/runs/6555137521/job/17803175138?pr=19402 * normally I'd use PEP440 for this (either vendored or through the appropriate PyPA lib) but maybe you'd prefer to cheat like this on major version vs. more infrastructure? --- array_api_compat/common/_linalg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/array_api_compat/common/_linalg.py b/array_api_compat/common/_linalg.py index f3b62038..97c584be 100644 --- a/array_api_compat/common/_linalg.py +++ b/array_api_compat/common/_linalg.py @@ -5,7 +5,11 @@ from typing import Literal, Optional, Sequence, Tuple, Union from ._typing import ndarray -from numpy.core.numeric import normalize_axis_tuple +import numpy as np +if np.__version__[0] == "2": + from numpy.lib.array_utils import normalize_axis_tuple +else: + from numpy.core.numeric import normalize_axis_tuple from ._aliases import matmul, matrix_transpose, tensordot, vecdot from .._internal import get_xp