我使用以下命令创建了一个 dataproc 集群
gcloud dataproc clusters create datascience \
--initialization-actions \
gs://dataproc-initialization-actions/jupyter/jupyter.sh \
但是,当我提交 PySpark 作业时,出现以下错误
Exception: Python in worker has different version 3.4 than that in driver 3.7, PySpark cannot run with different minor versions.Please check environment variables PYSPARK_PYTHON and PYSPARK_DRIVER_PYTHON are correctly set.
有什么想法吗?
最佳答案
这是由于 master 和 worker 之间的 python 版本不同。默认情况下,jupyter image
安装最新版本的 miniconda,它使用 python3.7。但是,worker 仍然使用默认的python3.6。
解决方案:
- 创建主节点时指定 miniconda 版本,即在主节点中安装 python3.6
gcloud dataproc clusters create example-cluster --metadata=MINICONDA_VERSION=4.3.30
笔记:
关于python-3.x - 由于 python 版本,运行 PySpark DataProc 作业时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51427175/