title: How to troubleshoot 'pyspark' is not recognized... error on Windows?
body: <p>It has been two weeks during which I have been trying to install Spark (pyspark) on my Windows 10 machine, now I realized that I need your help. </p>
  
  <p>When I try to start 'pyspark' in the command prompt, I still receive the following error:</p>
  
  <h2>The Problem</h2>
  
  <blockquote>
    <p>'pyspark' is not recognized as an internal or external command,
    operable program or batch file.</p>
  </blockquote>
  
  <p>To me this hints at a problem with the path/environmental variables, but I cannot find the root of the problem.</p>
  
  <h2>My Actions</h2>
  
  <p>I have tried multiple tutorials but the best I found was the one by <a href="https://medium.com/@GalarnykMichael/install-spark-on-windows-pyspark-4498a5d8d66c" rel="nofollow noreferrer">Michael Galarnyk</a>. I followed his tutorial step by step:</p>
  
  <ul>
  <li>Installed Java</li>
  <li>Installed Anaconda</li>
  <li><p>Downloaded Spark 2.3.1 (I changed the commands accordingly as Michael's tutorial uses a different version) from the official website. I moved it in line with the tutorial in the cmd prompt:</p>
  
  <pre><code>mv C:\Users\patri\Downloads\spark-2.3.1-bin-hadoop2.7.tgz C:\opt\spark\spark-2.3.1-bin-hadoop2.7.tgz
  </code></pre>
  
  <p>Then I untarred it:</p>
  
  <pre><code>gzip -d spark-2.3.1-bin-hadoop2.7.tgz
  </code></pre>
  
  <p>and</p>
  
  <pre><code>tar xvf spark-2.3.1-bin-hadoop2.7.tar
  </code></pre></li>
  <li><p>Downloaded Hadoop 2.7.1 from <a href="https://github.com/steveloughran/winutils/tree/master/hadoop-2.7.1/bin" rel="nofollow noreferrer">Github</a>:</p>
  
  <pre><code>curl -k -L -o winutils.exe https://github.com/steveloughran/winutils/raw/master/hadoop-2.7.1/bin/winutils.exe?raw=true
  </code></pre></li>
  <li><p>Set my Environmental Variables accordingly:</p>
  
  <pre><code>setx SPARK_HOME C:\opt\spark\spark-2.3.1-bin-hadoop2.7
  setx HADOOP_HOME C:\opt\spark\spark-2.3.1-bin-hadoop2.7
  setx PYSPARK_DRIVER_PYTHON jupyter
  setx PYSPARK_DRIVER_PYTHON_OPTS notebook
  </code></pre>
  
  <p>Then added <em>C:\opt\spark\spark-2.3.1-bin-hadoop2.7\bin</em> to my path    variables. My environmental user variables now look like this:
  <a href="https://i.stack.imgur.com/uILXE.png" rel="nofollow noreferrer">Current Environmental Variables</a></p></li>
  </ul>
  
  <p>These actions should have done the trick, but when I run <code>pyspark --master local[2]</code>, I still get the error from above. Can you help to track down this error using the information from above?</p>
  
  <h2>Checks</h2>
  
  <p>I ran a couple of checks in the command prompt to verify the following:</p>
  
  <ul>
  <li>Java is installed</li>
  <li>Anaconda is installed</li>
  <li>pip is installed</li>
  <li>Python is installed</li>
  </ul>