Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Databases and Redis

A Spark Connect session fails to start because grpcio-status is missing

Your error

ModuleNotFoundError: No module named 'grpc_status'1 more line it can show

Fix it fast

Most common cause, 1 of 2

pyspark was installed without the connect extra

Install the extra at the version of pyspark you already run, so pip does not move pyspark itself.

Fix
python -m pip install "pyspark[connect]==4.3.0"
# or, client-only, for sc:// connection URIs:
python -m pip install "pyspark-client==4.3.0"
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

No module named 'grpc_status' means PySpark tried to open a Spark Connect session (remote(), --remote or SPARK_REMOTE) and the grpcio-status package is not installed in that Python. A plain pip install pyspark leaves out the Connect extras. Run python -m pip install "pyspark[connect]" with the same interpreter, or use pyspark-client. PySpark 4.3.0 reports it as PACKAGE_NOT_INSTALLED.

  • Applies to PySpark 4.3.0 (grpcio-status >= 1.76.0), PySpark 3.5.9, grpcio-status 1.85.3, pip on Python 3.11 and later
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Print which interpreter runs your code and whether it can see the Connect packages. If grpc_status is missing in that interpreter while pyspark is present, cause 1 applies. If the package shows up in your terminal but not in the notebook or IDE, cause 2 applies.

Run this first
python -c "import sys; print(sys.executable)"
python -m pip show pyspark grpcio grpcio-status | grep -E "^(Name|Version|Location)"

Then find the line you see in this list and open its fix:

  1. 1pyspark was installed without the connect extrapip show lists pyspark but not grpcio-status, and the code calls SparkSession.builder.remote(...), starts pyspark with --remote, or sets SPARK_REMOTE
  2. 2pip installed the Connect packages for another interpreterpip show finds grpcio-status in a terminal, but sys.executable printed inside the notebook, IDE or job is another path

What does the error look like?

  • ModuleNotFoundError: No module named 'grpc_status'
  • [PACKAGE_NOT_INSTALLED] grpcio-status >= 1.48.1 must be installed; however, it was not found.

Cause 1 of 2

pyspark was installed without the connect extra

You seepip show lists pyspark but not grpcio-status, and the code calls SparkSession.builder.remote(...), starts pyspark with --remote, or sets SPARK_REMOTE

Check

No module named 'grpc_status' at session start means the Spark Connect client code was reached but one of its packages is absent. The PySpark install guide lists pandas, pyarrow, grpcio, grpcio-status, googleapis-common-protos and zstandard as required for Spark Connect, all pulled in by the connect extra. In 4.3.0 the dependency check imports grpc_status and turns the failure into PACKAGE_NOT_INSTALLED; the 3.5.9 client imports it directly.

Check
python -m pip show grpcio-status || echo "grpcio-status missing"

Fix

Install the extra at the version of pyspark you already run, so pip does not move pyspark itself. For a machine that only talks to a remote server over sc://, the pure-Python pyspark-client package carries the same Connect dependencies without the JVM parts.

Fix
python -m pip install "pyspark[connect]==4.3.0"
# or, client-only, for sc:// connection URIs:
python -m pip install "pyspark-client==4.3.0"

Verify

A session opens and runs a query against the Connect server.

Verify
python -c 'from pyspark.sql import SparkSession; s = SparkSession.builder.remote("sc://localhost:15002").getOrCreate(); print(s.range(3).count())'

Confirmed by spark.apache.org

Did this fix it?

Cause 2 of 2

pip installed the Connect packages for another interpreter

You seepip show finds grpcio-status in a terminal, but sys.executable printed inside the notebook, IDE or job is another path

Check

Installing into one environment and running from another gives the same missing-module error. pip installs for the interpreter that runs it, and python -m pip makes that explicit: /usr/bin/python3 -m pip installs for /usr/bin/python3 only. Jupyter kernels, IDE run configurations and virtual environments each point at their own interpreter.

Check
python -c "import grpc_status, sys; print(sys.executable, grpc_status.__file__)"

Fix

Take the path printed by sys.executable in the failing environment and run pip through exactly that interpreter. Restart the notebook kernel or IDE run afterwards so it loads the new packages.

Fix
# inside the notebook or failing script:
import sys; print(sys.executable)
# then in a terminal, with that exact path:
/path/from/sys.executable -m pip install "pyspark[connect]==4.3.0"

Verify

Importing grpc_status in the notebook or job prints a file path from the same environment as sys.executable.

Verify
python -c "import grpc_status; print(grpc_status.__file__)"

Confirmed by pip.pypa.io

Did this fix it?

How do I stop it coming back?

  • Pin pyspark[connect]==<version> in requirements.txt instead of plain pyspark whenever code uses remote() or SPARK_REMOTE.
  • Install with python -m pip from the environment that runs the job, and print sys.executable in the job's first log line.
  • Use pyspark-client in containers that only connect to a Spark Connect server; it needs no JVM or jars and lists every Connect dependency itself.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: stegnor.com, Menulo, ShopGo.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.