title: PYspark SparkContext Error "error occurred while calling None.org.apache.spark.api.java.JavaSparkContext."
body: <p>I know this question has been posted before, but I tried implementing the solutions, but none worked for me. I installed Spark for Jupyter Notebook
  using this tutorial:</p>
  
  <pre><code>https://medium.com/@GalarnykMichael/install-spark-on-mac-pyspark-
  453f395f240b#.be80dcqat
  </code></pre>
  
  <p>Installed Latest Version of Apache Spark on the MAC</p>
  
  <p>When I try to run the following code in Jupyter</p>
  
  <pre><code>wordcounts = sc.textFile('words.txt')
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>name 'sc' is not defined
  </code></pre>
  
  <p>When I try adding the Code: </p>
  
  <pre><code>from pyspark import SparkContext, SparkConf
  sc =SparkContext()
  </code></pre>
  
  <p>getting the following error:</p>
  
  <pre><code>An error occurred while calling 
  None.org.apache.spark.api.java.JavaSparkContext.
  : java.lang.NoClassDefFoundError: Could not initialize class 
  org.apache.hadoop.util.StringUtils
  at
  org.apache.hadoop.security.SecurityUtil.
  getAuthenticationMethod(SecurityUtil.java:611)
  </code></pre>
  
  <p>Added the path in bash:</p>
  
  <pre><code>export SPARK_PATH=~/spark-2.2.1-bin-hadoop2.7
  export PYSPARK_DRIVER_PYTHON="jupyter"
  export PYSPARK_DRIVER_PYTHON_OPTS="notebook"
  
  #For python 3, You have to add the line below or you will get an error
  # export PYSPARK_PYTHON=python3
  alias snotebook='$SPARK_PATH/bin/pyspark --master local[2]'
  </code></pre>
  
  <p>Please help me resolve this.</p>