diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 9a00fe03ea07..b3fe73f4697d 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -31,7 +31,8 @@ requires = [ # Avoid https://github.com/pypa/virtualenv/issues/2006 "distlib==0.4.4", # Numpy headers - "numpy>=1.23.2,<2.6.0", # Update setup.py as well. + "numpy>=1.23.2,<2.6.0; python_version >= '3.12'", # Update setup.py as well. + "numpy>=1.23.2,<2.5.0; python_version < '3.12'", # having cython here will create wheels that are platform dependent. "cython>=3.2.6,<4", ## deps for generating external transform wrappers: diff --git a/sdks/python/setup.py b/sdks/python/setup.py index 8236944aea19..98d5b631f13b 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -446,7 +446,8 @@ def get_portability_package_data(): # Use a strict upper bound. # Increment the lower bound when the minimum Python version is # updated. - 'numpy>=1.23.2,<2.6.0', # Update pyproject.toml as well. + 'numpy>=1.23.2,<2.6.0; python_version >= "3.12"', # Update pyproject.toml as well. + 'numpy>=1.23.2,<2.5.0; python_version < "3.12"', 'objsize>=0.6.1,<0.8.0', 'packaging>=22.0', 'pillow>=12.1.1,<14',