Skip to content

[SPARK-56452][PYTHON] Fix pip install failure for prerelease versions#55311

Open
kiyeonjeon21 wants to merge 1 commit intoapache:masterfrom
kiyeonjeon21:SPARK-56452
Open

[SPARK-56452][PYTHON] Fix pip install failure for prerelease versions#55311
kiyeonjeon21 wants to merge 1 commit intoapache:masterfrom
kiyeonjeon21:SPARK-56452

Conversation

@kiyeonjeon21
Copy link
Copy Markdown

What changes were proposed in this pull request?

Updated the version validation regexes in python/pyspark/install.py to accept prerelease version strings (e.g. 4.2.0.dev4).

Two regexes were updated:

  • checked_versions() (line 71): the regex that detects bare version strings and prepends spark-
  • convert_old_hadoop_version() (line 109): the regex that extracts major/minor version parts

Both now include an optional (?:\.dev[0-9]+)? suffix.

Why are the changes needed?

When installing a PySpark prerelease via pip (e.g. pip install pyspark==4.2.0.dev4), the version string 4.2.0.dev4 does not match the existing regex ^[0-9]+\.[0-9]+\.[0-9]+$. This causes the spark- prefix to not be added, which then triggers a RuntimeError:

RuntimeError: Spark version should start with 'spark-' prefix; however, got 4.2.0.dev4

GitHub issue: #55289

Does this PR introduce any user-facing change?

Yes. Previously, pip install pyspark==4.2.0.dev4 would fail with a RuntimeError. After this fix, prerelease versions install correctly.

How was this patch tested?

Added two test cases in test_checked_versions for prerelease versions:

  • checked_versions("4.2.0.dev4", "3", "2.3") — bare version with dev suffix
  • checked_versions("spark-4.2.0.dev4", "hadoop3", "hive2.3") — already prefixed version with dev suffix

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

No.

The version validation regex in install.py rejects prerelease version
strings like "4.2.0.dev4" because it only matches X.Y.Z format. This
adds an optional ".devN" suffix to both regexes in checked_versions()
and convert_old_hadoop_version().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant