作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个 Spark 集群,通过 ssh 进入 master,然后启动 shell:
MASTER=yarn-client ./spark/bin/pyspark
当我执行以下操作时:
x = sc.textFile("s3://location/files.*")
xt = x.map(lambda x: handlejson(x))
table= sqlctx.inferSchema(xt)
我收到以下错误:
Error from python worker:
/usr/bin/python: No module named pyspark
PYTHONPATH was:
/mnt1/var/lib/hadoop/tmp/nm-local-dir/usercache/hadoop/filecache/11/spark-assembly-1.1.0-hadoop2.4.0.jar
java.io.EOFException
java.io.DataInputStream.readInt(DataInputStream.java:392)
org.apache.spark.api.python.PythonWorkerFactory.startDaemon(PythonWorkerFactory.scala:151)
org.apache.spark.api.python.PythonWorkerFactory.createThroughDaemon(PythonWorkerFactory.scala:78)
org.apache.spark.api.python.PythonWorkerFactory.create(PythonWorkerFactory.scala:54)
org.apache.spark.SparkEnv.createPythonWorker(SparkEnv.scala:97)
org.apache.spark.api.python.PythonRDD.compute(PythonRDD.scala:66)
org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:262)
org.apache.spark.rdd.RDD.iterator(RDD.scala:229)
org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:62)
org.apache.spark.scheduler.Task.run(Task.scala:54)
org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:177)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)
我还检查了 PYTHONPATH
>>> os.environ['PYTHONPATH'] '/home/hadoop/spark/python/lib/py4j-0.8.2.1-src.zip:/home/hadoop/spark/python/:/home/hadoop/spark/lib/spark-assembly-1.1.0-hadoop2.4.0.jar'
在 jar 里寻找 pyspark,它就在那里:
jar -tf /home/hadoop/spark/lib/spark-assembly-1.1.0-hadoop2.4.0.jar | grep pyspark
pyspark/
pyspark/shuffle.py
pyspark/resultiterable.py
pyspark/files.py
pyspark/accumulators.py
pyspark/sql.py
pyspark/java_gateway.py
pyspark/join.py
pyspark/serializers.py
pyspark/shell.py
pyspark/rddsampler.py
pyspark/rdd.py
....
有人遇到过这种情况吗?谢谢!
最佳答案
您需要引用这些 Spark 问题:
解决方案(假设您不想重建 jar):
unzip -d foo spark/lib/spark-assembly-1.1.0-hadoop2.4.0.jar
cd foo
# if you don't have openjdk 1.6:
# yum install -y java-1.6.0-openjdk-devel.x86_64
/usr/lib/jvm/openjdk-1.6.0/bin/jar cvmf META-INF/MANIFEST ../spark/lib/spark-assembly-1.1.0-hadoop2.4.0.jar .
# don't neglect the dot at the end of that command
关于python - AWS EMR Spark "No Module named pyspark",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26919632/
我是一名优秀的程序员,十分优秀!