To build SparkR on Windows, the following steps are required
-
Install R (>= 3.1) and Rtools. Make sure to include Rtools and R in
PATH. -
Install JDK8 and set
JAVA_HOMEin the system environment variables. -
Download and install Maven. Also include the
bindirectory in Maven inPATH. -
Set
MAVEN_OPTSas described in Building Spark. -
Open a command shell (
cmd) in the Spark directory and build Spark with Maven and include the-Psparkrprofile to build the R package. For example to use the default Hadoop versions you can runmvn.cmd -DskipTests -Psparkr package
.\build\mvnis a shell script somvn.cmdshould be used directly on Windows.
To run the SparkR unit tests on Windows, the following steps are required —assuming you are in the Spark root directory and do not have Apache Hadoop installed already:
-
Create a folder to download Hadoop related files for Windows. For example,
cd ..andmkdir hadoop. -
Download the relevant Hadoop bin package from steveloughran/winutils. While these are not official ASF artifacts, they are built from the ASF release git hashes by a Hadoop PMC member on a dedicated Windows VM. For further reading, consult Windows Problems on the Hadoop wiki.
-
Install the files into
hadoop\bin; make sure thatwinutils.exeandhadoop.dllare present. -
Set the environment variable
HADOOP_HOMEto the full path to the newly createdhadoopdirectory. -
Run unit tests for SparkR by running the command below. You need to install the testthat package first:
R -e "install.packages('testthat', repos='http://cran.us.r-project.org')" .\bin\spark-submit2.cmd --conf spark.hadoop.fs.defaultFS="file:///" R\pkg\tests\run-all.R