RuntimeError: Java gateway process exited before sending its port number after setting JAVA_HOME

huangapple go评论68阅读模式
英文:

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 &quot;c:\Users\Erevos\Desktop\Pyspark\LearnSpark.py&quot;, line 5, in &lt;module&gt;
    spark = SparkSession.builder.appName(&quot;MyApp&quot;).getOrCreate()
  File &quot;C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\sql\session.py&quot;, line 477, in getOrCreate
    sc = SparkContext.getOrCreate(sparkConf)
  File &quot;C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py&quot;, line 512, in getOrCreate
    SparkContext(conf=conf or SparkConf())
  File &quot;C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py&quot;, line 198, in __init__
    SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
  File &quot;C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\context.py&quot;, line 432, in _ensure_initialized
    SparkContext._gateway = gateway or launch_gateway(conf)
  File &quot;C:\Users\Erevos\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspark\java_gateway.py&quot;, line 106, in launch_gateway
    raise RuntimeError(&quot;Java gateway process exited before sending its port number&quot;)
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.

huangapple
  • 本文由 发表于 2023年5月7日 17:15:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76193048.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定