Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spark + Python - Java gateway process exited before sending the driver its port number?

Why do I get this error on my browser screen,

: Java gateway process exited before sending the driver its port number args = ('Java gateway process exited before sending the driver its port number',) message = 'Java gateway process exited before sending the driver its port number'

for,

#!/Python27/python
print "Content-type: text/html; charset=utf-8"
print

# enable debugging
import cgitb
cgitb.enable()

import os
import sys

# Path for spark source folder
os.environ['SPARK_HOME'] = "C:\Apache\spark-1.4.1"

# Append pyspark to Python Path
sys.path.append("C:\Apache\spark-1.4.1\python")

from pyspark import SparkContext
from pyspark import SparkConf

print ("Successfully imported Spark Modules")

# Initialize SparkContext
sc = SparkContext('local')
words = sc.parallelize(["scala","java","hadoop","spark","akka"])
print words.count()

I followed this example.

Any ideas how I can fix it?

like image 394
Run Avatar asked Aug 05 '15 07:08

Run


1 Answers

Check if there are any extra information before the Error line that says:

Error: Could not create the Java Virtual Machine.

In my case it was an invalid option that I had set in the conf file. Memory (initial heap size) is not allowed to have a comma: 3.5g is for example not acceptable whereas 3500m is.

like image 176
architectonic Avatar answered Oct 23 '22 03:10

architectonic