gpt4 book ai didi

python - Pyspark,以编程方式初始化 spark : IllegalArgumentException: Missing application resource

转载 作者:太空狗 更新时间:2023-10-30 00:01:48 25 4
gpt4 key购买 nike

在 Python 中创建 spark 上下文时,出现以下错误。

 app_name="my_app"
master="local[*]"
sc = SparkContext(appName=app_name, master=master)

Exception in thread "main" java.lang.IllegalArgumentException: Missing application resource.
at org.apache.spark.launcher.CommandBuilderUtils.checkArgument(CommandBuilderUtils.java:241)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitArgs(SparkSubmitCommandBuilder.java:160)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildSparkSubmitCommand(SparkSubmitCommandBuilder.java:276)
at org.apache.spark.launcher.SparkSubmitCommandBuilder.buildCommand(SparkSubmitCommandBuilder.java:151)
at org.apache.spark.launcher.Main.main(Main.java:86)

....

pyspark.zip/pyspark/java_gateway.py", line 94, in launch_gateway
raise Exception("Java gateway process exited before sending the driver its port number")
Exception: Java gateway process exited before sending the driver its port number

Spark 发射器似乎以某种方式出现故障。

最佳答案

这是由于先前存在的环境变量发生冲突而发生的。我在 python 程序中删除了它们,现在它运行顺利。

例如:

import  os
#check if pyspark env vars are set and then reset to required or delete.
del os.environ['PYSPARK_SUBMIT_ARGS']

正确的解决方案是在 .bashrc 或 .zshrc 或任何初始化它的 env 初始化脚本中删除它。但无法在 .bash_profile(mac)(.bashrc 或/etc/environment.conf)中找到它。如果找到位置,将更新答案

关于python - Pyspark,以编程方式初始化 spark : IllegalArgumentException: Missing application resource,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39860907/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com