Whenever I am trying to execute a simple processing in pyspark, it fails to open the socket.
>>> myRDD = sc.parallelize(range(6), 3)
>>> sc
I was having the exact same error, tried JDK 1.7 and it didn't work, then i went and edited the /etc/hosts file and realized i had the following lines
127.0.0.1 mbp.local localhost
127.0.0.1 localhost
Just commented out the line with my computer local name and it worked.
#127.0.0.1 mbp.local localhost
127.0.0.1 localhost
Tested on PySpark 1.6.3 and 2.0.2 with JDK 1.8