soxofaan commented on a change in pull request #23736: [SPARK-26831][PYTHON] 
bin/pyspark: eliminate use of hardcoded 'python' command and fix IPython 
version check
URL: https://github.com/apache/spark/pull/23736#discussion_r254456848
 
 

 ##########
 File path: bin/pyspark
 ##########
 @@ -42,11 +42,10 @@ if [[ -z "$PYSPARK_DRIVER_PYTHON" ]]; then
   PYSPARK_DRIVER_PYTHON="${PYSPARK_PYTHON:-"python"}"
 fi
 
-WORKS_WITH_IPYTHON=$(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* && ! $WORKS_WITH_IPYTHON ]]; then
+  WORKS_WITH_IPYTHON=$(python -c 'import sys; print(sys.version_info >= (2, 7, 
0))')
 
 Review comment:
   @srowen   you mean that there should no version checks whatsoever, or the 
checks should not be about IPython, just about python >= 2.7.
   
   Something like for example
   ```bash
   if [[ -z "$PYSPARK_PYTHON" ]]; then
     PYSPARK_PYTHON=python
   fi
   if [[ $($PYSPARK_PYTHON -c 'import sys; print(sys.version_info >= (2, 7, 
0))') != "True" ]]; then
     echo "PYSPARK_PYTHON ($PYSPARK_PYTHON) should be Python 2.7 or higher" 1>&2
     exit 1
   fi
   
   if [[ -z "$PYSPARK_DRIVER_PYTHON" ]]; then
     PYSPARK_DRIVER_PYTHON=$PYSPARK_PYTHON
   fi
   if [[ $($PYSPARK_DRIVER_PYTHON -c 'import sys; print(sys.version_info >= (2, 
7, 0))') != "True" ]]; then
     echo "PYSPARK_DRIVER_PYTHON ($PYSPARK_DRIVER_PYTHON) should be Python 2.7 
or higher" 1>&2
     exit 1
   fi
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to