I recently started using mac and there I have installed pyspark. Now whenever I try to create a SparkSession .
spark = (
SparkSession.builder
.getOrCreate()
)
It throws me an error if I execute/debug it from pycharm although it works fine if i run the python program via terminal eg: python main.py.
The error it throws is:
The operation couldn’t be completed. Unable to locate a Java Runtime. Please visit http://www.java.com for information on installing Java.
/usr/local/lib/python3.9/site-packages/pyspark/bin/spark-class: line 96: CMD: bad array subscript head: illegal line count -- -1
RuntimeError: Java gateway process exited before sending its port number
Can someone help me on this ?