Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does spark-submit and spark-shell fail with "Failed to find Spark assembly JAR. You need to build Spark before running this program."?

Tags:

apache-spark

I was trying to run spark-submit and I get "Failed to find Spark assembly JAR. You need to build Spark before running this program." When I try to run spark-shell I get the same error. What I have to do in this situation.

like image 648
Silver Jay Avatar asked Dec 23 '14 10:12

Silver Jay


4 Answers

On Windows, I found that if it is installed in a directory that has a space in the path (C:\Program Files\Spark) the installation will fail. Move it to the root or another directory with no spaces.

like image 182
jurban1997 Avatar answered Oct 21 '22 00:10

jurban1997


Your Spark package doesn't include compiled Spark code. That's why you got the error message from these scripts spark-submit and spark-shell.

You have to download one of pre-built version in "Choose a package type" section from the Spark download page.

like image 37
suztomo Avatar answered Oct 21 '22 02:10

suztomo


Try running mvn -DskipTests clean package first to build Spark.

like image 28
Lina Avatar answered Oct 21 '22 01:10

Lina


If your spark binaries are in a folder where the name of the folder has spaces (for example, "Program Files (x86)"), it didn't work. I changed it to "Program_Files", then the spark_shell command works in cmd.

like image 32
Solomon Avatar answered Oct 21 '22 00:10

Solomon