【问题标题】:pyspark.sql module error: Python in worker has different version 2.7 than that in driver 3.7, PySpark cannot run with different minor versionspyspark.sql 模块错误:worker 中的 Python 2.7 版本与驱动程序 3.7 中的版本不同,PySpark 无法使用不同的次要版本运行
【发布时间】:2019-10-15 23:40:39
【问题描述】:
df = spark.read.parquet('xxx')
tmstmp = df['timestamp']

spark.conf.set("spark.sql.session.timeZone", "Singapore")

time_df = spark.createDataFrame([('tmstmp',)], ['unix_time'])
time_df.select(from_unixtime('unix_time').alias('ts')).collect()

df['timestamp'] = time_df

spark.conf.unset("spark.sql.session.timeZone")

此行有错误:

time_df.select(from_unixtime('unix_time').alias('ts')).collect()

异常错误消息:

异常:worker 中的 Python 2.7 版本与驱动程序 3.7 中的版本不同,PySpark 无法使用不同的次要版本运行。请检查环境变量 PYSPARK_PYTHON 和 PYSPARK_DRIVER_PYTHON 是否设置正确。

【问题讨论】:

    标签: pyspark jupyter pyspark-sql


    【解决方案1】:

    您收到的例外情况本身就很清楚。 您有一个包含两个或更多节点的集群。您提交此命令的服务器/节点(主服务器)与您的其他节点(工作人员)具有不同版本的 python。

    可能的解决方案:

    • 提升您的工作节点 python 版本或将PYSPARK_PYTHON env 设置为 python3.7 安装。
    • 更改您的驱动程序 python 版本以匹配工作节点版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多