Line 38 is a comment indicating that Spark will use 8GB of RAM, but the following line sets spark.driver.memory to 25GB. One or the other needs to be updated for consistency.
38: # Give Spark 8GB of RAM, used Python3
39: echo "spark.driver.memory 25g" | sudo tee -a $SPARK_HOME/conf/spark-defaults.conf
Line 38 is a comment indicating that Spark will use 8GB of RAM, but the following line sets spark.driver.memory to 25GB. One or the other needs to be updated for consistency.