英文:
RuntimeError: Java gateway process exited before sending its port number after setting JAVA_HOME
问题
I'm trying to start pyspark using VSCode but i am getting the follow errors:
Java not found and JAVA_HOME environment variable is not set. Install Java and set JAVA_HOME to point to the Java installation directory. Traceback (most recent call last): File "c:\Users\Erevos\Desktop\Pyspark\LearnSpark.py", line 5, in <module> spark = SparkSession.builder.appName("MyApp").getOrCreate() File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\sql\session.py", line 477, in getOrCreate sc = SparkContext.getOrCreate(sparkConf) File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 512, in getOrCreate SparkContext(conf=conf or SparkConf()) File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 198, in __init__ SparkContext._ensure_initialized(self, gateway=gateway, conf=conf) File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 432, in _ensure_initialized SparkContext._gateway = gateway or launch_gateway(conf) File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\java_gateway.py", line 106, in launch_gateway raise RuntimeError("Java gateway process exited before sending its port number") RuntimeError: Java gateway process exited before sending its port number
i have already set the JAVA_HOME = path, here
Moreover, i have downloaded the folders required: here
英文:
I'm trying to start pyspark using VSCode but i am getting the follow errors:
Java not found and JAVA_HOME environment variable is not set.
Install Java and set JAVA_HOME to point to the Java installation directory.
Traceback (most recent call last):
File "c:\Users\Erevos\Desktop\Pyspark\LearnSpark.py", line 5, in <module>
spark = SparkSession.builder.appName("MyApp").getOrCreate()
File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\sql\session.py", line 477, in getOrCreate
sc = SparkContext.getOrCreate(sparkConf)
File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 512, in getOrCreate
SparkContext(conf=conf or SparkConf())
File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 198, in __init__
SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py", line 432, in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway(conf)
File "C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\java_gateway.py", line 106, in launch_gateway
raise RuntimeError("Java gateway process exited before sending its port number")
RuntimeError: Java gateway process exited before sending its port number
i have already set the JAVA_HOME = path, here
Moreover, i have downloaded the folders required: here
答案1
得分: 0
尝试输出环境变量
echo %JAVA_HOME%
并检查是否正确。
如果不正确,请再次检查您的 JAVA_HOME 分配。
然后,关闭并重新打开运行 java 进程的命令提示符(或操作系统用户会话),然后输入 java -version
以检查是否成功安装。
如果 java 命令失败,请参考此 链接。
查看此 链接 以获取有关 JAVA_HOME 的更多信息。
英文:
Try to output the env variable
echo %JAVA_HOME%
and check if it's correct.
If not correct check again your JAVA_HOME assignment.
Then, close and reopen the command prompt again that runs the java process (or the OS user session) and type java -version
to check if it installed successfully.
If the java command fails follow this link.
Follow this link to have more info about JAVA_HOME.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论