Pyspark: Exception: Java gateway process exited before sending the driver its port number
One possible reason is JAVA_HOME is not set because java is not installed. I encountered the same issue. It says at sc = pyspark.SparkConf(). I solved it by running which is from https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04