title: Downloading spark-csv in Windows
body: <p>I am a beginner in the Spark world, and want to do my Machine Learning algorithms using SparkR.</p>
  
  <p>I installed Spark in standalone mode in my laptop (Win 7 64-bit) and I am available to run Spark (1.6.1), Pyspark and begin SparkR in Windows following this effective guide: <a href="https://edumine.wordpress.com/2015/06/11/how-to-install-apache-spark-on-a-windows-7-environment/" rel="nofollow noreferrer">link</a> . Once I started SparkR I began with the famous Flights example:</p>
  
  <pre><code>#Set proxy
  Sys.setenv(http_proxy="http://user:password@proxy.companyname.es:8080/")
  #Set SPARK_HOME
  Sys.setenv(SPARK_HOME="C:/Users/amartinezsistac/spark-1.6.1-bin-hadoop2.4")
  #Load SparkR and its library
  .libPaths(c(file.path(Sys.getenv("SPARK_HOME"),"R", "lib"), .libPaths()))
  library(SparkR)
  #Set Spark Context and SQL Context
  sc = sparkR.init(master="local")
  sqlContext &lt;- sparkRSQL.init(sc)
  #Read Data
  link &lt;- "s3n://mortar-example-data/airline-data"
  flights &lt;- read.df(sqlContext, link, source = "com.databricks.spark.csv", header= "true")
  </code></pre>
  
  <p>Nevertheless, I receive the next error message after the last line:</p>
  
  <pre><code>Error in invokeJava(isStatic = TRUE, className, methodName, ...) : 
    java.lang.ClassNotFoundException: Failed to find data source: com.databricks.spark.csv. Please find packages at http://spark-packages.org
      at org.apache.spark.sql.execution.datasources.ResolvedDataSource$.lookupDataSource(ResolvedDataSource.scala:77)
      at org.apache.spark.sql.execution.datasources.ResolvedDataSource$.apply(ResolvedDataSource.scala:102)
      at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:119)
      at org.apache.spark.sql.api.r.SQLUtils$.loadDF(SQLUtils.scala:160)
      at org.apache.spark.sql.api.r.SQLUtils.loadDF(SQLUtils.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.apache.spark.api.r.RBackendHandler.handleMethodCall(RBackendHandler.scala:141)
      at org.apache.spark.api.r.RBackendHandler.ch
  </code></pre>
  
  <p>It seems like the reason is that I do not have installed the read-csv package, which can be downloaded from this page (<a href="https://github.com/databricks/spark-csv" rel="nofollow noreferrer">Github link</a>). As well as in Stack, in spark-packages.org website, (<a href="https://stackoverflow.com/questions/32585686/options-to-read-large-files-pure-text-xml-json-csv-from-hdfs-in-rstudio-wit">link</a>) the advice is to do: <code>$SPARK_HOME/bin/spark-shell --packages com.databricks:spark-csv_2.11:1.4.0</code> which is for a Linux installation.</p>
  
  <p>My question is: How could I run this code line from Windows 7 <code>cmd</code> in order to download this package?</p>
  
  <p>I also tried an alternate solution for my error message (<a href="https://github.com/databricks/spark-csv/issues/233" rel="nofollow noreferrer">Github</a>) without success:</p>
  
  <pre><code>#In master you don't need spark-csv. 
  #CSV data source is built into SparkSQL. Just use it as follows:
  flights &lt;- read.df(sqlContext, "out/data.txt", source = "com.databricks.spark.csv", delimiter="\t", header="true", inferSchema="true")
  </code></pre>
  
  <p>Thanks in advance to everyone.</p>