Repository: spark
Updated Branches:
  refs/heads/branch-1.6 83f860448 -> 1026aba16


[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 <mks...@nyu.edu>

Closes #13503 from MechCoder/spark-15761.

(cherry picked from commit 66283ee0b25de2a5daaa21d50a05a7fadec1de77)
Signed-off-by: Sean Owen <so...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/1026aba1
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/1026aba1
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/1026aba1

Branch: refs/heads/branch-1.6
Commit: 1026aba16554f6c5b5a6a3fdc2b9bdb7911a9fcc
Parents: 83f8604
Author: MechCoder <mks...@nyu.edu>
Authored: Fri Jul 1 09:27:34 2016 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Fri Jul 1 09:27:54 2016 +0100

----------------------------------------------------------------------
 bin/pyspark | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/1026aba1/bin/pyspark
----------------------------------------------------------------------
diff --git a/bin/pyspark b/bin/pyspark
index 5eaa17d..42af597 100755
--- a/bin/pyspark
+++ b/bin/pyspark
@@ -54,9 +54,11 @@ elif [[ -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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to