I am trying to install pyspark as this:
python setup.py install I get this error:
Could not import pypandoc - required to package PySpark pypandoc is installed already
Any ideas how can I install pyspark?
I faced the same issue and solved it as below install pypandoc before installing pyspark
pip install pypandoc pip install pyspark pip3 install pypandoc (after running sudo apt install python3-pip) solved the problemIf you are using window follow the following steps:
1) install Jdk in the computer from link: https://www.oracle.com/technetwork/java/javase/downloads/index.html
2) set the environment variable $JAVA_HOME= /path/where/you/installed/jdk than add path in the PATH=%JAVA_HOME/bin
3)download the spark from the link:- https://spark.apache.org/downloads.html this file in the Zip format extract the file and file name is like spark-2.3.1-bin-hadoop2.7.tgz , move this folder to the C Directory. and set the environment variable
SPARK_HOME=/path/of the /spark 4)download the scala ide from the link :- http://scala-ide.org/ extract the file and copy the Eclipse folder to the C: directory
5) now open cmd and write spark-shell it will open the scala shell for you.
2018 version-
Install PYSPARK on Windows 10 JUPYTER-NOTEBOOK with ANACONDA NAVIGATOR.
Download Packages
1) spark-2.2.0-bin-hadoop2.7.tgz Download
2) Java JDK 8 version Download
3) Anaconda v 5.2 Download
4) scala-2.12.6.msi Download
5) hadoop v2.7.1 Download
Create SPARK folder in C:/ drive and extract Hadoop, spark and install Scala using scala-2.12.6.msi in the same directory. The directory structure should be It will look like this
Note: During installation of SCALA, specify C:/Spark folder
Now set the windows environment variables:
HADOOP_HOME=C:\spark\hadoop
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
SCALA_HOME=C:\spark\scala\bin
SPARK_HOME=C:\spark\spark\bin
PYSPARK_PYTHON=C:\Users\user\Anaconda3\python.exe
PYSPARK_DRIVER_PYTHON=C:\Users\user\Anaconda3\Scripts\jupyter.exe
PYSPARK_DRIVER_PYTHON_OPTS=notebook
NOW SELECT PATH OF SPARK :
Click on Edit and add New
Add "C:\spark\spark\bin” to variable “Path” Windows
thats it your browser will pop up with Juypter localhost
Check if PySpark is working or not !
Type simple code and run it
from pyspark.sql import Row a = Row(name = 'Vinay' , age=22 , height=165) print("a: ",a) Steps to install PySpark API for jupyter notebook:
Go to this site https://spark.apache.org/downloads.html to download latest spark. The file will be downloaded in .tgz format. Extract this tgz file in a directory where you want to install PySpark.
After extracting the tgz file , you will need to download hadoop because Apache spark requires Hadoop, so download hadoop from https://github.com/steveloughran/winutils/blob/master/hadoop-2.7.1/bin/winutils.exe, A file will be downloaded - 'winutils.exe'. Copy this exe file in the 'bin/' directory of your spark (spark-2.2.0-bin-hadoop2.7/bin)
If you have anaconda installed, there will be .condarc file in C:\Users\, open that, change ssl_verify from true to false. This will help you to install python libraries directly from prompt.(In case if you have restricted network)
Open anaconda prompt and type 'conda install findspark' to install findspark python module.If you are not able to install it, go to this link https://github.com/minrk/findspark and download ZIP,extract it and open anaconda prompt and go to this extracted path and run 'python setup.py install'.
Open ThisPC>> Properties>> Advanced System Settings(You need to have admin access for that).Click on Environment Variables and then Add new user environment variables. 
After creating 4 user variables and adding spark path to 'PATH' system variable, open jupyter notebook and run this code:
import findspark findspark.init() import pyspark from pyspark.sql import SQLContext from pyspark import SparkContext sc = SparkContext("local", "First App") sqlContext = SQLContext(sc) If you dont get any error, the installation has been completed successfully.
what worked for me (windows 10) was:
What worked for me inside docker was actually done in three steps:
RUN python -m pip install --upgrade pip RUN pip3 install pypandoc RUN pip install -r requirements.txt --no-input Or shorter:
RUN python -m pip install --upgrade pip && \ pip3 install pypandoc && \ pip install -r requirements.txt --no-input