diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 9a00fe03ea07..cbb469f6848d 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -30,8 +30,9 @@ requires = [ "mypy-protobuf==3.5.0", # 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 headers - Update setup.py as well. + "numpy>=1.23.2,<2.5.0; python_version < '3.12'", + "numpy>=1.23.2,<2.6.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..2715a4134cfe 100644 --- a/sdks/python/setup.py +++ b/sdks/python/setup.py @@ -445,8 +445,9 @@ def get_portability_package_data(): # numpy can have breaking changes in minor versions. # 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. + # updated. Update pyproject.toml as well. + 'numpy>=1.23.2,<2.5.0; python_version < "3.12"', + 'numpy>=1.23.2,<2.6.0; python_version >= "3.12"', 'objsize>=0.6.1,<0.8.0', 'packaging>=22.0', 'pillow>=12.1.1,<14',