Skip to content

Commit 23bf307

Browse files
MechCodermengxr
authored andcommitted
[SPARK-8032] [PYSPARK] Make version checking for NumPy in MLlib more robust
The current checking does version `1.x' is less than `1.4' this will fail if x has greater than 1 digit, since x > 4, however `1.x` < `1.4` It fails in my system since I have version `1.10` :P Author: MechCoder <manojkumarsivaraj334@gmail.com> Closes apache#6579 from MechCoder/np_ver and squashes the following commits: 15430f8 [MechCoder] fix syntax error 893fb7e [MechCoder] remove equal to e35f0d4 [MechCoder] minor e89376c [MechCoder] Better checking 22703dd [MechCoder] [SPARK-8032] Make version checking for NumPy in MLlib more robust (cherry picked from commit 452eb82) Signed-off-by: Xiangrui Meng <meng@databricks.com>
1 parent aefb113 commit 23bf307

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/pyspark/mllib/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
# MLlib currently needs and NumPy 1.4+, so complain if lower
2323

2424
import numpy
25-
if numpy.version.version < '1.4':
25+
26+
ver = [int(x) for x in numpy.version.version.split('.')[:2]]
27+
if ver < [1, 4]:
2628
raise Exception("MLlib requires NumPy 1.4+")
2729

2830
__all__ = ['classification', 'clustering', 'feature', 'linalg', 'random',

0 commit comments

Comments
 (0)