Skip to content

Commit

Permalink
[SPARK-48710][PYTHON][3.5] Limit NumPy version to supported range (>=…
Browse files Browse the repository at this point in the history
…1.15,<2)

### What changes were proposed in this pull request?
 * Add a constraint for `numpy<2` to the PySpark package

### Why are the changes needed?

PySpark references some code which was removed with NumPy 2.0. Thus, if `numpy>=2` is installed, executing PySpark may fail.

apache#47083 updates the `master` branch to be compatible with NumPy 2. This PR adds a version bound for older releases, where it won't be applied.

### Does this PR introduce _any_ user-facing change?
NumPy will be limited to `numpy<2` when installing `pypspark` with extras `ml`, `mllib`, `sql`, `pandas_on_spark` or `connect`.

### How was this patch tested?
Via existing CI jobs.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#47175 from codesorcery/SPARK-48710-numpy-upper-bound.

Authored-by: Patrick Marx <6949483+codesorcery@users.noreply.github.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
codesorcery authored and HyukjinKwon committed Jul 3, 2024
1 parent ef4e456 commit 44eba46
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,25 +307,25 @@ def run(self):
# if you're updating the versions or dependencies.
install_requires=["py4j==0.10.9.7"],
extras_require={
"ml": ["numpy>=1.15"],
"mllib": ["numpy>=1.15"],
"ml": ["numpy>=1.15,<2"],
"mllib": ["numpy>=1.15,<2"],
"sql": [
"pandas>=%s" % _minimum_pandas_version,
"pyarrow>=%s" % _minimum_pyarrow_version,
"numpy>=1.15",
"numpy>=1.15,<2",
],
"pandas_on_spark": [
"pandas>=%s" % _minimum_pandas_version,
"pyarrow>=%s" % _minimum_pyarrow_version,
"numpy>=1.15",
"numpy>=1.15,<2",
],
"connect": [
"pandas>=%s" % _minimum_pandas_version,
"pyarrow>=%s" % _minimum_pyarrow_version,
"grpcio>=%s" % _minimum_grpc_version,
"grpcio-status>=%s" % _minimum_grpc_version,
"googleapis-common-protos>=%s" % _minimum_googleapis_common_protos_version,
"numpy>=1.15",
"numpy>=1.15,<2",
],
},
python_requires=">=3.8",
Expand Down

0 comments on commit 44eba46

Please sign in to comment.