cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Pyspark installation issue

_r_vind1199
New Contributor II

When I try to start pyspark session in pycharm. It throws me this error "RuntimeError("Java gateway process exited before sending its port number"). Could anyone help me to solve this?

1 ACCEPTED SOLUTION

Accepted Solutions

Aashita
Contributor III
Contributor III

@Aravind Aโ€‹ , What are the dependencies and versions you installed?

Install pyspark + openjdk

%pip install pyspark==2.4.8
!apt-get install openjdk-8-jdk-headless -qq > /dev/null

Build spark session

from pyspark.sql import SparkSession
spark = SparkSession.builder\
    .appName("Practiceโ€)\
    .getOrCreate()

Note that:

Spark runs on Java 8/11, Scala 2.12/2.13, Python 3.6+ and R 3.5+. 

Python 3.6 support is deprecated as of Spark 3.2.0. 

Java 8 prior to version 8u201 support is deprecated as of Spark 3.2.0. 

For the Scala API, Spark 3.2.1 uses Scala 2.12. You will need to use a compatible Scala version (2.12.x). 

https://spark.apache.org/docs/latest/

View solution in original post

4 REPLIES 4

Aashita
Contributor III
Contributor III

@Aravind Aโ€‹ , What are the dependencies and versions you installed?

Install pyspark + openjdk

%pip install pyspark==2.4.8
!apt-get install openjdk-8-jdk-headless -qq > /dev/null

Build spark session

from pyspark.sql import SparkSession
spark = SparkSession.builder\
    .appName("Practiceโ€)\
    .getOrCreate()

Note that:

Spark runs on Java 8/11, Scala 2.12/2.13, Python 3.6+ and R 3.5+. 

Python 3.6 support is deprecated as of Spark 3.2.0. 

Java 8 prior to version 8u201 support is deprecated as of Spark 3.2.0. 

For the Scala API, Spark 3.2.1 uses Scala 2.12. You will need to use a compatible Scala version (2.12.x). 

https://spark.apache.org/docs/latest/

_r_vind1199
New Contributor II

@Aashita Ramtekeโ€‹ , Pyspark version 3.2.1

Kindly replace the version when you install python dependencies from 2.4.8 to 3.2.1.. It should work. Thanks.

Kaniz_Fatma
Community Manager
Community Manager

Hi @Aravind Aโ€‹ , Did you try all the steps as suggested by @Aashita Ramtekeโ€‹ ?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!