Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions bin/find-spark-home
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,5 @@ elif [ ! -f "$FIND_SPARK_HOME_PYTHON_SCRIPT" ]; then
else
# We are pip installed, use the Python script to resolve a reasonable SPARK_HOME
# Default to standard python interpreter unless told otherwise
if [[ -z "$PYSPARK_DRIVER_PYTHON" ]]; then
PYSPARK_DRIVER_PYTHON="${PYSPARK_PYTHON:-"python"}"
fi
export SPARK_HOME=$($PYSPARK_DRIVER_PYTHON "$FIND_SPARK_HOME_PYTHON_SCRIPT")
export SPARK_HOME=$(${PYSPARK_PYTHON:-"python"} "$FIND_SPARK_HOME_PYTHON_SCRIPT")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm .. can we strip the non-printable characters instead?
Respecting PYSPARK_DRIVER_PYTHON falling back to PYSPARK_PYTHON is expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least I can come up with one way although it's hacky. e.g.)

a=$(ipython -c "import sys; print('/User', file=sys.stderr)" 2>&1 >/dev/null)
ls $a

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a workaround for ipython, but not for jupyter, because jupyter doesn't support jupyter find_spark_home.py. I think PYSPARK_DRIVER_PYTHON is more meant for "frontend". This fix enables PYSPARK_DRIVER_PYTHON=jupyter PYSPARK_DRIVER_PYTHON_OPTS=notebook  pyspark too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, PYSPARK_DRIVER_PYTHON's falling back to PYSPARK_PYTHON happens after find-spark-home too:

PYSPARK_DRIVER_PYTHON=$PYSPARK_PYTHON

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mzhang-code, can we just add a bandaid fix like: if PYSPARK_DRIVER_PYTHON ends with jupyter or ipython, uses PYSPARK_PYTHON or python for now with some comments about why we're using PYSPARK_PYTHON instead of PYSPARK_DRIVER_PYTHON?

fi