Pyspark not starting


#1

error: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server
Traceback (most recent call last):
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 690, in start
self.socket.connect((self.address, self.port))
File “/usr/lib64/python2.7/socket.py”, line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server
Traceback (most recent call last):
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 690, in start
self.socket.connect((self.address, self.port))
File “/usr/lib64/python2.7/socket.py”, line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
Traceback (most recent call last):
File “/usr/hdp/current/spark-client/python/pyspark/shell.py”, line 43, in
sc = SparkContext(pyFiles=add_files)
File “/usr/hdp/current/spark-client/python/pyspark/context.py”, line 115, in init
conf, jsc, profiler_cls)
File “/usr/hdp/current/spark-client/python/pyspark/context.py”, line 172, in _do_init
self._jsc = jsc or self._initialize_context(self._conf._jconf)
File “/usr/hdp/current/spark-client/python/pyspark/context.py”, line 245, in _initialize_context
return self._jvm.JavaSparkContext(jconf)
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 1062, in call
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 631, in send_command
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 624, in send_command
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 579, in _get_connection
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 585, in _create_connection
File “/usr/hdp/current/spark-client/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py”, line 697, in start
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server


#2

@Sumanta_Bardhan Please share the command? which you are trying to launch pyspark?


#3

PYSPARK going down 2 times in last 2 days. pls look into this asap

18/11/13 21:55:27 WARN Utils: Service ‘SparkUI’ could not bind on port 4055. Attempting port 4056.
18/11/13 21:55:27 ERROR SparkUI: Failed to bind SparkUI
java.net.BindException: Address already in use: Service ‘SparkUI’ failed after 16 retries (starting from 4040)! Consider explicitly setting the appropriate port for the service ‘SparkUI’ (for example spark.ui.port for SparkUI) to an available port or increasing spark.port.maxRetries.
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.spark_project.jetty.server.ServerConnector.open(ServerConnector.java:317)
at org.spark_project.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.spark_project.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.spark_project.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.apache.spark.ui.JettyUtils$.org$apache$spark$ui$JettyUtils$$newConnector$1(JettyUtils.scala:352)
at org.apache.spark.ui.JettyUtils$.org$apache$spark$ui$JettyUtils$$httpConnect$1(JettyUtils.scala:379)
at org.apache.spark.ui.JettyUtils$$anonfun$7.apply(JettyUtils.scala:382)
at org.apache.spark.ui.JettyUtils$$anonfun$7.apply(JettyUtils.scala:382)
at org.apache.spark.util.Utils$$anonfun$startServiceOnPort$1.apply$mcVI$sp(Utils.scala:2271)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:160)
at org.apache.spark.util.Utils$.startServiceOnPort(Utils.scala:2263)
at org.apache.spark.ui.JettyUtils$.startJettyServer(JettyUtils.scala:382)
at org.apache.spark.ui.WebUI.bind(WebUI.scala:130)
at org.apache.spark.SparkContext$$anonfun$11.apply(SparkContext.scala:451)
at org.apache.spark.SparkContext$$anonfun$11.apply(SparkContext.scala:451)
at scala.Option.foreach(Option.scala:257)
at org.apache.spark.SparkContext.(SparkContext.scala:451)
at org.apache.spark.api.java.JavaSparkContext.(JavaSparkContext.scala:58)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:247)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:238)
at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
at py4j.GatewayConnection.run(GatewayConnection.java:214)
at java.lang.Thread.run(Thread.java:745)
ERROR:root:Exception while sending command.
Traceback (most recent call last):
File “/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py”, line 1062, in send_command
raise Py4JNetworkError(“Answer from Java side is empty”)
py4j.protocol.Py4JNetworkError: Answer from Java side is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py”, line 908, in send_command
response = connection.send_command(command)
File “/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py”, line 1067, in send_command
“Error while receiving”, e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:45348)
Traceback (most recent call last):
File “/usr/hdp/current/spark2-client/python/pyspark/shell.py”, line 45, in
spark = SparkSession.builder
File “/usr/hdp/current/spark2-client/python/pyspark/sql/session.py”, line 173, in getOrCreate
sc = SparkContext.getOrCreate(sparkConf)
File “/usr/hdp/current/spark2-client/python/pyspark/context.py”, line 340, in getOrCreate
SparkContext(conf=conf or SparkConf())
File “/usr/hdp/current/spark2-client/python/pyspark/context.py”, line 119, in init
conf, jsc, profiler_cls)
File “/usr/hdp/current/spark2-client/python/pyspark/context.py”, line 181, in _do_init
self._jsc = jsc or self._initialize_context(self._conf._jconf)
File “/usr/hdp/current/spark2-client/python/pyspark/context.py”, line 279, in _initialize_context
return self._jvm.JavaSparkContext(jconf)
File “/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py”, line 1428, in call
answer, self._gateway_client, None, self._fqn)
File “/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/protocol.py”, line 328, in get_return_value


#4

@My_Learning You can launch pyspark using pyspark --master yarn --conf spark.ui.port=five_digit_number (eg: pyspark --master yarn --conf spark.ui.port=12569)