Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-32180][PYTHON][DOCS] Installation page of Getting Started in PySpark documentation #29640

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/docs/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
Getting Started
===============

This page summarizes the basic steps required to setup and get started with PySpark.

.. toctree::
:maxdepth: 2

installation
quickstart
120 changes: 120 additions & 0 deletions python/docs/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

.. http://www.apache.org/licenses/LICENSE-2.0

.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

============
Installation
============

Official releases are available from `the Apache Spark website <https://spark.apache.org/downloads.html>`_.
Alternatively, you can install it via ``pip`` from PyPI. PyPI installation is usually for standalone
locally or as a client to connect to a cluster instead of setting a cluster up.

This page includes the instructions for installing PySpark by using pip, Conda, downloading manually, and building it from the source.

Python Version Supported
------------------------

Python 3.6 and above.

Using PyPI
----------

PySpark installation using `PyPI <https://pypi.org/project/pyspark/>`_

.. code-block:: bash

pip install pyspark

Using Conda
-----------

Conda is an open-source package management and environment management system which is a part of `Anaconda <https://docs.continuum.io/anaconda/>`_ distribution. It is both cross-platform and language agnostic.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of the


Conda can be used to create a virtual environment from terminal as shown below:

.. code-block:: bash

conda create -n pyspark_env

After the virtual environment is created, it should be visible under the list of Conda environments which can be seen using the following command:

.. code-block:: bash

conda env list

The newly created environment can be accessed using the following command:

.. code-block:: bash

conda activate pyspark_env

In Conda version earlier than 4.4, the following command might be used:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be used


.. code-block:: bash

source activate pyspark_env

PySpark installation using ``pip`` under Conda environment is official.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean?

Copy link
Author

@rohitmishr1484 rohitmishr1484 Sep 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen, The information this sentence conveys is -

  • Using Conda to install PySpark via conda-forge is not the official way to do it.
  • But If we create a Conda environment using conda and then install PySpark in the new environment then although it's an indirect way of installation but meets the official implementation guideline.

I am fine with removing this line if you and @HyukjinKwon think it's implicit and not required to be mentioned explicitly. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean 'official' here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen,

As per my understanding "official" implies the most updated source used to setup PySpark. Based on this understanding- PyPI is considered official whereas Conda-forge is not. Please feel free to correct me if there is a caveat in my understanding. Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this line


PySpark can be installed in this newly created environment using PyPI as shown before:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why repeat this?

Copy link
Author

@rohitmishr1484 rohitmishr1484 Sep 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen, This was added to make sure new users understand the entire flow under one section but we can certainly remove this statement and link the step to the "Using PyPI" section. Is that fine?

Proposed change: PySpark can be installed in this newly created environment using the command specified in Using PyPI <#using-pypi>_


.. code-block:: bash

pip install pyspark

`PySpark at Conda <https://anaconda.org/conda-forge/pyspark>`_ is not the official release.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, I don't think this matters

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just say, for example:

Note that PySpark at Conda <https://anaconda.org/conda-forge/pyspark>_ is available but not necessarily synced with PySpark release cycle because it is maintained by the community separately.


Official Release Channel
------------------------

Different flavors of PySpark is available in the `official release channel <https://spark.apache.org/downloads.html>`_.
Any suitable version can be downloaded and extracted as below:

.. code-block:: bash

tar xzvf spark-3.0.0-bin-hadoop2.7.tgz

Ensure the ``SPARK_HOME`` environment variable points to the directory where the code has been extracted.
Define ``PYTHONPATH`` such that it can find the PySpark and
Py4J under ``$SPARK_HOME/python/lib``, one example of doing this is shown below:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(By the way I think you need just single back-ticks?)
Start a new sentence at "One example"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh fyi double backticks here make it like a code block. single backtick makes italic for some reasons.


.. code-block:: bash

cd spark-3.0.0-bin-hadoop2.7
export SPARK_HOME=`pwd`
export PYTHONPATH=$(ZIPS=("$SPARK_HOME"/python/lib/*.zip); IFS=:; echo "${ZIPS[*]}"):$PYTHONPATH

Installing from Source
----------------------

To install PySpark from source, refer to `Building Spark <https://spark.apache.org/docs/latest/building-spark.html>`_.

Refer to `Official Release Channel <#official-release-channel>`_ for steps to define ``PYTHONPATH``.

Dependencies
------------
============= ========================= ==========================================================================
Package Minimum supported version Note
============= ========================= ==========================================================================
`pandas` 0.23.2 Optional for SQL component
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just write like:

Optional for SQL
Required for ML
Optional for SQL

Seems too long. Sorry for a bit of forth and back here.

`NumPy` 1.7 Required for ML component(Optional in PySpark if ML component is not used)
`pyarrow` 0.15.1 Optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyarrow is also currently only Optional for SQL.

`Py4J` 0.10.9 Required
============= ========================= ==========================================================================

**Note**: A prerequisite for PySpark installation is the availability of JAVA 8 or later and ``JAVA_HOME`` properly set.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JAVA -> Java
Nit: you can avoid a lot of these passive sentences. "PySpark requires Java 8 or later, with JAVA_HOME properly set" for example.

For using JDK 11, set ``-Dio.netty.tryReflectionSetAccessible=true`` for Arrow related features and refer to `Downloading <https://spark.apache.org/docs/latest/#downloading>`_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using Java 11, set ...