---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/installation/spark-installation-pyspark.md
  - href: en/installation/spark-installation-pyspark.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# For PySpark

<!-- source: en/_includes/work_src/reusage-installation/spark__dep-versions.md -->
Get the appropriate `catboost_spark_version` (see available versions at [Maven central](https://search.maven.org/search?q=catboost-spark)).

Choose the appropriate `spark_compat_version` (`2.x`, `3.x`, or `4.x` where `x` is a minor release version) and `scala_compat_version` (`2.11`, `2.12` or `2.13`, corresponding to versions supported by the particular Spark version).
<!-- endsource: en/_includes/work_src/reusage-installation/spark__dep-versions.md -->

Just add the `catboost-spark` Maven artifact with the appropriate `spark_compat_version`, `scala_compat_version` and `catboost_spark_version` to `spark.jar.packages` Spark config parameter and import the `catboost_spark` package:

```python
from pyspark.sql import SparkSession

sparkSession = (SparkSession.builder
    .master(...)
    .config("spark.jars.packages", "ai.catboost:catboost-spark_<spark_compat_version>_<scala_compat_version>:<catboost_spark_version>")
    .getOrCreate()
)

import catboost_spark

...

```
