title: Spark RDD - Error while sending iterator
body: <p>So, I'm just trying to iterate over a Spark RDD and perform an action on each row, like so:</p>
  
  <pre><code>for row in df.rdd.toLocalIterator():
      print(row)
  </code></pre>
  
  <p>But I get a weird exception:</p>
  
  <pre><code>ERROR PythonRDD:91 - Error while sending iterator
  java.lang.IllegalArgumentException
      at org.apache.xbean.asm5.ClassReader.&lt;init&gt;(Unknown Source)
      at org.apache.xbean.asm5.ClassReader.&lt;init&gt;(Unknown Source)
      at org.apache.xbean.asm5.ClassReader.&lt;init&gt;(Unknown Source)
      at org.apache.spark.util.ClosureCleaner$.getClassReader(ClosureCleaner.scala:46)
      at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:449)
      at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:432)
      at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
      at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
      at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
      at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
      at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
      at scala.collection.mutable.HashMap$$anon$1.foreach(HashMap.scala:103)
      at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
      at org.apache.spark.util.FieldAccessFinder$$anon$3.visitMethodInsn(ClosureCleaner.scala:432)
      at org.apache.xbean.asm5.ClassReader.a(Unknown Source)
      at org.apache.xbean.asm5.ClassReader.b(Unknown Source)
      at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
      at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
      at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:262)
      at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:261)
      at scala.collection.immutable.List.foreach(List.scala:381)
      at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:261)
      at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:159)
      at org.apache.spark.SparkContext.clean(SparkContext.scala:2292)
      at org.apache.spark.SparkContext.runJob(SparkContext.scala:2066)
      at org.apache.spark.rdd.RDD$$anonfun$toLocalIterator$1.org$apache$spark$rdd$RDD$$anonfun$$collectPartition$1(RDD.scala:954)
      at org.apache.spark.rdd.RDD$$anonfun$toLocalIterator$1$$anonfun$apply$30.apply(RDD.scala:956)
      at org.apache.spark.rdd.RDD$$anonfun$toLocalIterator$1$$anonfun$apply$30.apply(RDD.scala:956)
      at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
      at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
      at scala.collection.Iterator$class.foreach(Iterator.scala:893)
      at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
      at org.apache.spark.api.python.PythonRDD$.writeIteratorToStream(PythonRDD.scala:204)
      at org.apache.spark.api.python.PythonRDD$$anon$1$$anonfun$run$1.apply$mcV$sp(PythonRDD.scala:400)
      at org.apache.spark.api.python.PythonRDD$$anon$1$$anonfun$run$1.apply(PythonRDD.scala:400)
      at org.apache.spark.api.python.PythonRDD$$anon$1$$anonfun$run$1.apply(PythonRDD.scala:400)
      at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1377)
      at org.apache.spark.api.python.PythonRDD$$anon$1.run(PythonRDD.scala:401)
  </code></pre>
  
  <p>Seems oddly dev-ops-y to me, and I'm wondering if I botched a pip installation or something. Any suggestions?</p>
  
  <p>Thanks!</p>