[ https://issues.apache.org/jira/browse/SPARK-24739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16533191#comment-16533191 ]
Hyukjin Kwon commented on SPARK-24739: -------------------------------------- For this fix particularly, the fix is small and safe. In case of SPARK-19019, it was merged to from 1.6, 2.0, 2.1 and 2.2. I expect the similar situation with this JIRA's case with many stackoverflow questions. > PySpark does not work with Python 3.7.0 > --------------------------------------- > > Key: SPARK-24739 > URL: https://issues.apache.org/jira/browse/SPARK-24739 > Project: Spark > Issue Type: Bug > Components: PySpark > Affects Versions: 2.1.3, 2.2.2, 2.3.1 > Reporter: Hyukjin Kwon > Assignee: Hyukjin Kwon > Priority: Critical > > Python 3.7 is released in few days ago and our PySpark does not work. For > example > {code} > sc.parallelize([1, 2]).take(1) > {code} > {code} > File "/.../spark/python/pyspark/rdd.py", line 1343, in __main__.RDD.take > Failed example: > sc.parallelize(range(100), 100).filter(lambda x: x > 90).take(3) > Exception raised: > Traceback (most recent call last): > File "/.../3.7/lib/python3.7/doctest.py", line 1329, in __run > compileflags, 1), test.globs) > File "<doctest __main__.RDD.take[2]>", line 1, in <module> > sc.parallelize(range(100), 100).filter(lambda x: x > 90).take(3) > File "/.../spark/python/pyspark/rdd.py", line 1377, in take > res = self.context.runJob(self, takeUpToNumLeft, p) > File "/.../spark/python/pyspark/context.py", line 1013, in runJob > sock_info = self._jvm.PythonRDD.runJob(self._jsc.sc(), > mappedRDD._jrdd, partitions) > File "/.../spark/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", > line 1257, in __call__ > answer, self.gateway_client, self.target_id, self.name) > File "/.../spark/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line > 328, in get_return_value > format(target_id, ".", name), value) > py4j.protocol.Py4JJavaError: An error occurred while calling > z:org.apache.spark.api.python.PythonRDD.runJob. > : org.apache.spark.SparkException: Job aborted due to stage failure: Task > 0 in stage 143.0 failed 1 times, most recent failure: Lost task 0.0 in stage > 143.0 (TID 688, localhost, executor driver): > org.apache.spark.api.python.PythonException: Traceback (most recent call > last): > File "/.../spark/python/pyspark/rdd.py", line 1373, in takeUpToNumLeft > yield next(iterator) > StopIteration > The above exception was the direct cause of the following exception: > Traceback (most recent call last): > File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 320, > in main > process() > File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 315, > in process > serializer.dump_stream(func(split_index, iterator), outfile) > File "/.../spark/python/lib/pyspark.zip/pyspark/serializers.py", line > 378, in dump_stream > vs = list(itertools.islice(iterator, batch)) > RuntimeError: generator raised StopIteration > at > org.apache.spark.api.python.BasePythonRunner$ReaderIterator.handlePythonException(PythonRunner.scala:309) > at > org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:449) > at > org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:432) > at > org.apache.spark.api.python.BasePythonRunner$ReaderIterator.hasNext(PythonRunner.scala:263) > at > org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37) > at scala.collection.Iterator$class.foreach(Iterator.scala:891) > at > org.apache.spark.InterruptibleIterator.foreach(InterruptibleIterator.scala:28) > at > scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59) > at > scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:104) > at > scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:48) > at scala.collection.TraversableOnce$class.to(TraversableOnce.scala:310) > at > org.apache.spark.InterruptibleIterator.to(InterruptibleIterator.scala:28) > at > scala.collection.TraversableOnce$class.toBuffer(TraversableOnce.scala:302) > at > org.apache.spark.InterruptibleIterator.toBuffer(InterruptibleIterator.scala:28) > at > scala.collection.TraversableOnce$class.toArray(TraversableOnce.scala:289) > at > org.apache.spark.InterruptibleIterator.toArray(InterruptibleIterator.scala:28) > at > org.apache.spark.api.python.PythonRDD$$anonfun$3.apply(PythonRDD.scala:149) > at > org.apache.spark.api.python.PythonRDD$$anonfun$3.apply(PythonRDD.scala:149) > at > org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2071) > at > org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2071) > at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87) > at org.apache.spark.scheduler.Task.run(Task.scala:109) > at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:367) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Driver stacktrace: > at > org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1607) > at > org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1595) > at > org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1594) > at > scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) > at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) > at > org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1594) > at > org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:831) > at > org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:831) > at scala.Option.foreach(Option.scala:257) > at > org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:831) > at > org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1828) > at > org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1777) > at > org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1766) > at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:49) > at > org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:642) > at org.apache.spark.SparkContext.runJob(SparkContext.scala:2031) > at org.apache.spark.SparkContext.runJob(SparkContext.scala:2052) > at org.apache.spark.SparkContext.runJob(SparkContext.scala:2071) > at org.apache.spark.api.python.PythonRDD$.runJob(PythonRDD.scala:149) > at org.apache.spark.api.python.PythonRDD.runJob(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:244) > at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) > at py4j.Gateway.invoke(Gateway.java:282) > at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132) > at py4j.commands.CallCommand.execute(CallCommand.java:79) > at py4j.GatewayConnection.run(GatewayConnection.java:238) > at java.lang.Thread.run(Thread.java:748) > Caused by: org.apache.spark.api.python.PythonException: Traceback (most > recent call last): > File "/.../spark/python/pyspark/rdd.py", line 1373, in takeUpToNumLeft > yield next(iterator) > StopIteration > The above exception was the direct cause of the following exception: > Traceback (most recent call last): > File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 320, > in main > process() > File "/.../spark/python/lib/pyspark.zip/pyspark/worker.py", line 315, > in process > serializer.dump_stream(func(split_index, iterator), outfile) > File "/.../spark/python/lib/pyspark.zip/pyspark/serializers.py", line > 378, in dump_stream > vs = list(itertools.islice(iterator, batch)) > RuntimeError: generator raised StopIteration > at > org.apache.spark.api.python.BasePythonRunner$ReaderIterator.handlePythonException(PythonRunner.scala:309) > at > org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:449) > at > org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRunner.scala:432) > at > org.apache.spark.api.python.BasePythonRunner$ReaderIterator.hasNext(PythonRunner.scala:263) > at > org.apache.spark.InterruptibleIterator.hasNext(InterruptibleIterator.scala:37) > at scala.collection.Iterator$class.foreach(Iterator.scala:891) > at > org.apache.spark.InterruptibleIterator.foreach(InterruptibleIterator.scala:28) > at > scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59) > at > scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:104) > at > scala.collection.mutable.ArrayBuffer.$plus$plus$eq(ArrayBuffer.scala:48) > at scala.collection.TraversableOnce$class.to(TraversableOnce.scala:310) > at > org.apache.spark.InterruptibleIterator.to(InterruptibleIterator.scala:28) > at > scala.collection.TraversableOnce$class.toBuffer(TraversableOnce.scala:302) > at > org.apache.spark.InterruptibleIterator.toBuffer(InterruptibleIterator.scala:28) > at > scala.collection.TraversableOnce$class.toArray(TraversableOnce.scala:289) > at > org.apache.spark.InterruptibleIterator.toArray(InterruptibleIterator.scala:28) > at > org.apache.spark.api.python.PythonRDD$$anonfun$3.apply(PythonRDD.scala:149) > at > org.apache.spark.api.python.PythonRDD$$anonfun$3.apply(PythonRDD.scala:149) > at > org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2071) > at > org.apache.spark.SparkContext$$anonfun$runJob$5.apply(SparkContext.scala:2071) > at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87) > at org.apache.spark.scheduler.Task.run(Task.scala:109) > at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:367) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > ... 1 more > {code} > Should check the behaviour changes or bugs in Python and PySpark. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org