title: New to Spark. - getting java.net.BindException: Cannot assign requested address
body: <p>I am new to Spark.  Just installed version 1.6.0 in my laptop (Ubuntu) and proceeded with an example using the phyton's shell (pyspark).  However, I cannot figure out what this error is telling me.  Can you please help? any help is appreciated.  </p>
  
  <pre><code>&gt;&gt;&gt; lines = sc.textFile("spark-1.6.0/README.md")
  &gt;&gt;&gt; lines.count()
  Traceback (most recent call last):                                              
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/home/ricky/spark-1.6.0/python/pyspark/rdd.py", line 1004, in count
      return self.mapPartitions(lambda i: [sum(1 for _ in i)]).sum()
    File "/home/ricky/spark-1.6.0/python/pyspark/rdd.py", line 995, in sum
      return self.mapPartitions(lambda x: [sum(x)]).fold(0, operator.add)
    File "/home/ricky/spark-1.6.0/python/pyspark/rdd.py", line 869, in fold
      vals = self.mapPartitions(func).collect()
    File "/home/ricky/spark-1.6.0/python/pyspark/rdd.py", line 771, in collect
      port = self.ctx._jvm.PythonRDD.collectAndServe(self._jrdd.rdd())
    File "/home/ricky/spark-1.6.0/python/lib/py4j-0.9-    src.zip/py4j/java_gateway.py", line 813, in __call__
    File "/home/ricky/spark-1.6.0/python/pyspark/sql/utils.py", line 45, in   deco
      return f(*a, **kw)
    File "/home/ricky/spark-1.6.0/python/lib/py4j-0.9-   src.zip/py4j/protocol.py", line 308, **in get_return_value**
  py4j.protocol.Py4JJavaError: An error occurred while calling     z:org.apache.spark.api.python.PythonRDD.collectAndServe.
  : java.net.BindException: Cannot assign requested address
          at java.net.PlainSocketImpl.socketBind(Native Method)
          at     java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
          at java.net.ServerSocket.bind(ServerSocket.java:375)
          at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:237)
          at     org.apache.spark.api.python.PythonRDD$.serveIterator(PythonRDD.scala:637)
          at    org.apache.spark.api.python.PythonRDD$.collectAndServe(PythonRDD.scala:405)
          at  org.apache.spark.api.python.PythonRDD.collectAndServe(PythonRDD.scala)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at   sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)   
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java    :43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
          at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
          at py4j.Gateway.invoke(Gateway.java:259)
          at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
          at py4j.commands.CallCommand.execute(CallCommand.java:79)
          at py4j.GatewayConnection.run(GatewayConnection.java:209)
          at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p></p>
      </blockquote>
    </blockquote>
  </blockquote>