Pyspark Kernel with Jupyter

Vi Cheat Sheet
Photo by SpaceX

Install Java and Scala

        scala -version
        java -version

Install Java and export

        export JAVA_HOME=/usr/lib/jvm/java-8-oracle
        export JRE_HOME=/usr/lib/jvm/java-8-oracle/jre

Install py4j

        pip install py4j

Install py4j

        pip install py4j

Create pyspark kernel JSON

        {
         "display_name": "PySpark",
         "language": "python",
         "argv": [
          "<python_path>",
          "-m",
          "ipykernel",
          "-f",
          "{connection_file}"
         ],
         "env": {
          "SPARK_HOME": "<spark_home>",
          "PYTHONPATH": "<spark_home>/python/:<spark_home>/python/lib/py4j-0.9-src.zip",
          "PYTHONSTARTUP": "<spark_home>/python/pyspark/shell.py",
          "PYSPARK_SUBMIT_ARGS": "--master local[*] pyspark-shell"
         }
        }

References