title: Unable to start a Spark Session in Jupyter notebook
body: <p>First, this is not a duplicate of this <a href="https://stackoverflow.com/questions/64825755/cannot-create-a-spark-session-in-the-jupyter-notebook">question</a> . I just installed pyspark in windows, set up SPARK_HOME variable and ran findspark.init() to make sure there is no installation issue.</p>
  <p>running the pyspark shell, the spark (SparkSession) variable is created automatically and things work fine but when I wwant to start a spark session from Jupyter, then I get the following error</p>
  <pre><code>import pyspark
  from pyspark.sql import SparkSession
  spark = SparkSession.builder.getOrCreate()
      Exception                                 Traceback (most recent call last)
  &lt;ipython-input-20-39c4e6ac7c9b&gt; in &lt;module&gt;
        3 from pyspark.sql import SparkSession
        4 
  ----&gt; 5 spark = SparkSession.builder.getOrCreate()
        6 
  
  c:\users\ahg01\miniconda3\lib\site-packages\pyspark\sql\session.py in getOrCreate(self)
      184                             sparkConf.set(key, value)
      185                         # This SparkContext may be an existing one.
  --&gt; 186                         sc = SparkContext.getOrCreate(sparkConf)
      187                     # Do not update `SparkConf` for existing `SparkContext`, as it's shared
      188                     # by all sessions.
  
  c:\users\ahg01\miniconda3\lib\site-packages\pyspark\context.py in getOrCreate(cls, conf)
      374         with SparkContext._lock:
      375             if SparkContext._active_spark_context is None:
  --&gt; 376                 SparkContext(conf=conf or SparkConf())
      377             return SparkContext._active_spark_context
      378 
  
  c:\users\ahg01\miniconda3\lib\site-packages\pyspark\context.py in __init__(self, master, appName, sparkHome, pyFiles, environment, batchSize, serializer, conf, gateway, jsc, profiler_cls)
      131                 &quot; is not allowed as it is a security risk.&quot;)
      132 
  --&gt; 133         SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
      134         try:
      135             self._do_init(master, appName, sparkHome, pyFiles, environment, batchSize, serializer,
  
  c:\users\ahg01\miniconda3\lib\site-packages\pyspark\context.py in _ensure_initialized(cls, instance, gateway, conf)
      323         with SparkContext._lock:
      324             if not SparkContext._gateway:
  --&gt; 325                 SparkContext._gateway = gateway or launch_gateway(conf)
      326                 SparkContext._jvm = SparkContext._gateway.jvm
      327 
  
  c:\users\ahg01\miniconda3\lib\site-packages\pyspark\java_gateway.py in launch_gateway(conf, popen_kwargs)
      103 
      104             if not os.path.isfile(conn_info_file):
  --&gt; 105                 raise Exception(&quot;Java gateway process exited before sending its port number&quot;)
      106 
      107             with open(conn_info_file, &quot;rb&quot;) as info:
  
  Exception: Java gateway process exited before sending its port number
  </code></pre>
  <p>There is no existing SparkContext running, why am I getting this message? There is no predefined spark or sc variable, so I am not sure how to debug this issue</p>