Skip to content

Instantly share code, notes, and snippets.

@ololobus
Last active October 3, 2025 16:28
Show Gist options
  • Select an option

  • Save ololobus/4c221a0891775eaa86b0 to your computer and use it in GitHub Desktop.

Select an option

Save ololobus/4c221a0891775eaa86b0 to your computer and use it in GitHub Desktop.

Revisions

  1. ololobus revised this gist Jun 19, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -48,7 +48,7 @@ https://spark.apache.org/
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-spark.rb
    ```

    Also check `py4j` version and subpath, it mau differ from version to version.
    Also check `py4j` version and subpath, it may differ from version to version.


    Ipython profile
  2. ololobus revised this gist Jun 5, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,8 @@ https://spark.apache.org/
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-spark.rb
    ```

    Also check `py4j` version and subpath, it mau differ from version to version.


    Ipython profile
    ----------------------
  3. ololobus revised this gist Mar 27, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Apache Spark installation + ipython/jupyter notebook integration guide for Mac OS X
    ===================================================================================
    Apache Spark installation + ipython/jupyter notebook integration guide for macOS
    ================================================================================

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

  4. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284)
    <a>![Analytics](https://mc.yandex.ru/watch/42761284)

  5. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284.png)
    ![Analytics](https://mc.yandex.ru/watch/42761284)

  6. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284)
    ![Analytics](https://mc.yandex.ru/watch/42761284.png)

  7. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![Analytics](//mc.yandex.ru/watch/42761284)
    ![Analytics](https://mc.yandex.ru/watch/42761284)

  8. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![A](//mc.yandex.ru/watch/42761284.png)
    ![Analytics](//mc.yandex.ru/watch/42761284)

  9. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -95,5 +95,5 @@ $ pyspark
    which will open a web notebook with `sc` available automatically.


    ![](//mc.yandex.ru/watch/42761284.png)
    ![A](//mc.yandex.ru/watch/42761284.png)

  10. ololobus revised this gist Feb 13, 2017. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    Apache Spark installation + ipython/jupyter notebook integration guide for Mac OS X
    ===================================================================================
    ![Analytics](//mc.yandex.ru/watch/42761284.png)

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    @@ -94,3 +93,7 @@ and then simply run
    $ pyspark
    ```
    which will open a web notebook with `sc` available automatically.


    ![](//mc.yandex.ru/watch/42761284.png)

  11. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Apache Spark installation + ipython/jupyter notebook integration guide for Mac OS X
    ===================================================================================
    ![Analytics](https://mc.yandex.ru/watch/42761284)
    ![Analytics](//mc.yandex.ru/watch/42761284.png)

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

  12. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    Apache Spark installation + ipython/jupyter notebook integration guide for Mac OS X
    ===================================================================================
    ![Analytics](https://mc.yandex.ru/watch/42761284)

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    @@ -93,6 +94,3 @@ and then simply run
    $ pyspark
    ```
    which will open a web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284)
  13. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ It seems that it is not possible to run various custom startup files as it was w
    Run ipython
    -----------
    ```
    jupyter-notebook
    $ jupyter-notebook
    ```

    Initialize `pyspark`
  14. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Apache Spark installation + ipython/jupyter notebook integration guide for Mac O

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    For old versions of Spark and ipython, please, see also [previous version of text](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82).
    For older versions of Spark and ipython, please, see also [previous version of text](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82).


    Install Java Development Kit
  15. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Apache Spark installation + ipython/jupyter notebook integration guide for Mac O

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    For old versions of Spark and ipython, please, see [previous version](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82).
    For old versions of Spark and ipython, please, see also [previous version of text](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82).


    Install Java Development Kit
  16. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -92,7 +92,7 @@ and then simply run
    ```shell
    $ pyspark
    ```
    which will open web notebook with `sc` available automatically.
    which will open a web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284)
  17. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -81,7 +81,7 @@ Out[2]: <pyspark.context.SparkContext at 0x10a982b10>
    ```

    Alternatively
    =============
    -------------

    You can also force `pyspark` shell command to run ipython web notebook instead of command line interactive interpreter. To do so you have to add following env variables:
    ```shell
  18. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,7 @@ Out[2]: <pyspark.context.SparkContext at 0x10a982b10>
    Alternatively
    =============

    You can also force `pyspark` shell command to run ipython web notebook instead of command line intercative interpreter. To do so you have to add following env variables:
    You can also force `pyspark` shell command to run ipython web notebook instead of command line interactive interpreter. To do so you have to add following env variables:
    ```shell
    export PYSPARK_DRIVER_PYTHON=jupyter
    export PYSPARK_DRIVER_PYTHON_OPTS=notebook
  19. ololobus revised this gist Feb 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ $ ipython notebook --profile=pyspark
    [TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
    [W 01:45:07.821 NotebookApp] Unrecognized alias: '--profile=pyspark', it will probably have no effect.
    ```
    It seems that it is not possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook manually.
    It seems that it is not possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook manually or follow [alternative way](#alternatively).

    Run ipython
    -----------
  20. ololobus revised this gist Feb 13, 2017. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -80,4 +80,19 @@ In [2]: sc
    Out[2]: <pyspark.context.SparkContext at 0x10a982b10>
    ```

    Alternatively
    =============

    You can also force `pyspark` shell command to run ipython web notebook instead of command line intercative interpreter. To do so you have to add following env variables:
    ```shell
    export PYSPARK_DRIVER_PYTHON=jupyter
    export PYSPARK_DRIVER_PYTHON_OPTS=notebook
    ```
    and then simply run
    ```shell
    $ pyspark
    ```
    which will open web notebook with `sc` available automatically.


    ![Analytics](https://mc.yandex.ru/watch/42761284)
  21. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ Apache Spark installation + ipython/jupyter notebook integration guide for Mac O

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    For old versions of Spark and ipython, please, see [previous version](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82)
    For old versions of Spark and ipython, please, see [previous version](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82).


    Install Java Development Kit
  22. ololobus revised this gist Feb 12, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,8 @@ Apache Spark installation + ipython/jupyter notebook integration guide for Mac O

    Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112

    For old versions of Spark and ipython, please, see [previous version](https://gist.github.com/ololobus/4c221a0891775eaa86b0/956c90bceef6424ef74cc68c4b8b1acd688e1c82)


    Install Java Development Kit
    ----------------------------
  23. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ $ ipython notebook --profile=pyspark
    [TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
    [W 01:45:07.821 NotebookApp] Unrecognized alias: '--profile=pyspark', it will probably have no effect.
    ```
    It seems that it's possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook manually.
    It seems that it is not possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook manually.

    Run ipython
    -----------
  24. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-spark
    ```


    Create ipython profile
    Ipython profile
    ----------------------

    Since [profiles are not supported](http://jupyter.readthedocs.io/en/latest/migrating.html#since-jupyter-does-not-have-profiles-how-do-i-customize-it) in `jupyter` and now you can see following deprecation warning
  25. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -78,5 +78,4 @@ In [2]: sc
    Out[2]: <pyspark.context.SparkContext at 0x10a982b10>
    ```


    ![Analyticsas](https://mc.yandex.ru/watch/42761284)
    ![Analytics](https://mc.yandex.ru/watch/42761284)
  26. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -79,4 +79,4 @@ Out[2]: <pyspark.context.SparkContext at 0x10a982b10>
    ```


    ![Analytics](https://mc.yandex.ru/watch/42761284)
    ![Analyticsas](https://mc.yandex.ru/watch/42761284)
  27. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,7 @@ Run ipython
    jupyter-notebook
    ```

    Initialize `pyspark`
    ```ipython
    In [1]: import os
    execfile(os.path.join(os.environ["SPARK_HOME"], 'python/pyspark/shell.py'))
  28. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ $ ipython notebook --profile=pyspark
    [TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
    [W 01:45:07.821 NotebookApp] Unrecognized alias: '--profile=pyspark', it will probably have no effect.
    ```
    It seems that it's possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook.
    It seems that it's possible to run various custom startup files as it was with `ipython` profiles. Thus, the easiest way will be to run `pyspark` init script at the beginning of your notebook manually.

    Run ipython
    -----------
  29. ololobus revised this gist Feb 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/apache-spark
    Create ipython profile
    ----------------------

    Since ![profiles are not supported](http://jupyter.readthedocs.io/en/latest/migrating.html#since-jupyter-does-not-have-profiles-how-do-i-customize-it) in `jupyter` and now you can see following deprecation warning
    Since [profiles are not supported](http://jupyter.readthedocs.io/en/latest/migrating.html#since-jupyter-does-not-have-profiles-how-do-i-customize-it) in `jupyter` and now you can see following deprecation warning
    ```shell
    $ ipython notebook --profile=pyspark
    [TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
  30. ololobus revised this gist Feb 12, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Spark+ipython_on_MacOS.md
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,6 @@ Add following code to your e.g. `.bash_profile`
    # For a ipython notebook and pyspark integration
    if which pyspark > /dev/null; then
    export SPARK_HOME="/usr/local/Cellar/apache-spark/2.1.0/libexec/"
    export PYSPARK_SUBMIT_ARGS="--master local[2]"
    export PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/build:$PYTHONPATH
    export PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.10.4-src.zip:$PYTHONPATH
    fi