diff options
author | MechCoder <mks542@nyu.edu> | 2016-07-01 09:27:34 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-07-01 09:27:34 +0100 |
commit | 66283ee0b25de2a5daaa21d50a05a7fadec1de77 (patch) | |
tree | 30bc962b6a5b635f0190aa2a2c262d4147a0ec42 /bin | |
parent | 2075bf8ef6035fd7606bcf20dc2cd7d7b9cda446 (diff) | |
download | spark-66283ee0b25de2a5daaa21d50a05a7fadec1de77.tar.gz spark-66283ee0b25de2a5daaa21d50a05a7fadec1de77.tar.bz2 spark-66283ee0b25de2a5daaa21d50a05a7fadec1de77.zip |
[SPARK-15761][MLLIB][PYSPARK] Load ipython when default python is Python3
## What changes were proposed in this pull request?
I would like to use IPython with Python 3.5. It is annoying when it fails with IPython requires Python 2.7+; please install python2.7 or set PYSPARK_PYTHON when I have a version greater than 2.7
## How was this patch tested
It now works with IPython and Python3
Author: MechCoder <mks542@nyu.edu>
Closes #13503 from MechCoder/spark-15761.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pyspark | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/pyspark b/bin/pyspark index 396a07c9f4..ac8aa04dba 100755 --- a/bin/pyspark +++ b/bin/pyspark @@ -50,9 +50,11 @@ if [[ -z "$PYSPARK_DRIVER_PYTHON" ]]; then PYSPARK_DRIVER_PYTHON="${PYSPARK_PYTHON:-"$DEFAULT_PYTHON"}" fi +WORKS_WITH_IPYTHON=$($DEFAULT_PYTHON -c 'import sys; print(sys.version_info >= (2, 7, 0))') + # Determine the Python executable to use for the executors: if [[ -z "$PYSPARK_PYTHON" ]]; then - if [[ $PYSPARK_DRIVER_PYTHON == *ipython* && $DEFAULT_PYTHON != "python2.7" ]]; then + if [[ $PYSPARK_DRIVER_PYTHON == *ipython* && ! WORKS_WITH_IPYTHON ]]; then echo "IPython requires Python 2.7+; please install python2.7 or set PYSPARK_PYTHON" 1>&2 exit 1 else |