polynote.kernel.interpreter.python
Handle setting up PySpark.
Handle setting up PySpark.
First, we need to pick the python interpreter. Unfortunately this means we need to re-implement Spark's interpreter
configuration logic, because that's only implemented inside SparkSubmit (and only when you use pyspark-shell
actually).
Here's the order we follow for the driver python executable (from org.apache.spark.launcher.SparkSubmitCommandBuilder):
For the executors we just omit the driver python - so it's just:
Additionally, to load pyspark itself we try to grab the its location from the Spark distribution. This ensures that all the versions match up.
WARNING: Using pyspark from pip install pyspark
, could break things - don't use it!