Install & Compatibility
Where this runs
tested against v1.16.23 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.13
✕ build_error
✕ build_error
802MB installed
● package 802MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Spark
✓ from flytekitplugins.spark import Spark
Correct import for the Spark task type.
PySparkTask
✓ from flytekitplugins.spark import PySparkTask
✗ from flytekitplugins.spark.task import PySparkTask
PySparkTask is exposed at the top level; nested import was used in older docs.
Define a Spark task using task_config=Spark(...), then build a workflow.
from flytekit import task, workflow
from flytekitplugins.spark import Spark, PySparkTask
@task(task_config=Spark(
spark_conf={
"spark.executor.cores": "1",
"spark.executor.instances": "1"
}
))
def my_spark_task() -> int:
import pyspark
spark = pyspark.sql.SparkSession.builder.getOrCreate()
df = spark.range(10)
return df.count()
@workflow
def wf() -> int:
return my_spark_task()
if __name__ == "__main__":
print(wf())
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'flytekitplugins.spark'
Plugin package not installed.
fixRun 'pip install flytekitplugins-spark'.
AttributeError: module 'flytekitplugins.spark' has no attribute 'PySparkTask'
Deprecated import path used; PySparkTask not exposed in older versions or wrong import.
fixUse 'from flytekitplugins.spark import PySparkTask' (or upgrade flytekitplugins-spark).
Py4JJavaError: An error occurred while calling o123.showString.
Spark configuration missing required settings or cluster resources insufficient.
fixEnsure spark_conf includes 'spark.executor.cores' and 'spark.executor.instances'. Verify cluster is running.
Upgrade
Version history
1.16.23latest on PyPI · released Jun 2, 2026
Audit
Dependencies
flytekitrequiredCore Flyte SDK required.
pysparkrequiredSpark runtime dependency.