score:157

Accepted answer

here is a good explanation of your problem with the solution.

  1. download the version of winutils.exe from https://github.com/steveloughran/winutils.

  2. set up your hadoop_home environment variable on the os level or programmatically:

    system.setproperty("hadoop.home.dir", "full path to the folder with winutils");

  3. enjoy

score:-1

that's a tricky one... your storage letter must be capical. for example "c:\..."

score:0

on top of mentioning your environment variable for hadoop_home in windows as c:\winutils, you also need to make sure you are the administrator of the machine. if not and adding environment variables prompts you for admin credentials (even under user variables) then these variables will be applicable once you start your command prompt as administrator.

score:0

i have also faced the similar problem with the following details java 1.8.0_121, spark spark-1.6.1-bin-hadoop2.6, windows 10 and eclipse oxygen.when i ran my wordcount.java in eclipse using hadoop_home as a system variable as mentioned in the previous post, it did not work, what worked for me is -

system.setproperty("hadoop.home.dir", "path/to/the/dir");

path/to/the/dir/bin=winutils.exe whether you run within eclipse as a java application or by spark-submit from cmd using

spark-submit --class groupid.artifactid.classname --master local[2] /path to the jar file created using maven /path to a demo test file /path to output directory command

example: go to the bin location of spark/home/location/bin and execute the spark-submit as mentioned,

d:\bigdata\spark-2.3.0-bin-hadoop2.7\bin>spark-submit --class com.bigdata.abdus.sparkdemo.wordcount --master local[1] d:\bigdata\spark-quickstart\target\spark-quickstart-0.0.1-snapshot.jar d:\bigdata\spark-quickstart\wordcount.txt

score:1

setting the hadoop_home environment variable in system properties didn't work for me. but this did:

  • set the hadoop_home in the eclipse run configurations environment tab.
  • follow the 'windows environment setup' from here

score:1

  • download winutils.exe and hadoop.dll in your windows machine.
  • create folder c:\hadoop\bin
  • copy winutils.exe and hadoop.dll in newly created hadoop folder
  • setup environment variable hadoop_home=c:\hadoop

score:2

i got the same problem while running unit tests. i found this workaround solution:

the following workaround allows to get rid of this message:

    file workaround = new file(".");
    system.getproperties().put("hadoop.home.dir", workaround.getabsolutepath());
    new file("./bin").mkdirs();
    new file("./bin/winutils.exe").createnewfile();

from: https://issues.cloudera.org/browse/distro-544

score:4

if we see below issue

error shell: failed to locate the winutils binary in the hadoop binary path

java.io.ioexception: could not locate executable null\bin\winutils.exe in the hadoop binaries.

then do following steps

  1. download winutils.exe from http://public-repo-1.hortonworks.com/hdp- win-alpha/winutils.exe.
  2. and keep this under bin folder of any folder you created for.e.g. c:\hadoop\bin
  3. and in program add following line before creating sparkcontext or sparkconf system.setproperty("hadoop.home.dir", "c:\hadoop");

score:5

you can alternatively download winutils.exe from github:

https://github.com/steveloughran/winutils/tree/master/hadoop-2.7.1/bin

replace hadoop-2.7.1 with the version you want and place the file in d:\hadoop\bin

if you do not have access rights to the environment variable settings on your machine, simply add the below line to your code:

system.setproperty("hadoop.home.dir", "d:\\hadoop");

score:5

on windows 10 - you should add two different arguments.

(1) add the new variable and value as - hadoop_home and path (i.e. c:\hadoop) under system variables.

(2) add/append new entry to the "path" variable as "c:\hadoop\bin".

the above worked for me.

score:6

1) download winutils.exe from https://github.com/steveloughran/winutils 
2) create a directory in windows "c:\winutils\bin
3) copy the winutils.exe inside the above bib folder .
4) set the environmental property in the code 
  system.setproperty("hadoop.home.dir", "file:///c:/winutils/");
5) create a folder "file:///c:/temp" and give 777 permissions.
6) add config property in spark session ".config("spark.sql.warehouse.dir", "file:///c:/temp")"

score:30

follow this:

  1. create a bin folder in any directory(to be used in step 3).

  2. download winutils.exe and place it in the bin directory.

  3. now add system.setproperty("hadoop.home.dir", "path/to/the/dir"); in your code.

score:76

  1. download winutils.exe
  2. create folder, say c:\winutils\bin
  3. copy winutils.exe inside c:\winutils\bin
  4. set environment variable hadoop_home to c:\winutils

Related Query

More Query from same tag