DataprocSparkSession package in python error - "RuntimeError: Error while creating Dataproc Session"

11 views
Skip to first unread message

Siddiq

unread,
Oct 2, 2025, 4:20:13 AMOct 2
to Google Cloud Dataproc Discussions
Hi,

I am using below code to create Dataproc Spark Session to run a job

```
from google.cloud.dataproc_spark_connect import DataprocSparkSession
from google.cloud.dataproc_v1 import Session

session = Session()

session.environment_config.execution_config.subnetwork_uri = '<subnet>'
session.runtime_config.version = '2.3'
spark = DataprocSparkSession.builder.appName("CustomSparkSession").dataprocSessionConfig(session).getOrCreate()
```

I am getting an error as mentioned below

" RuntimeError: Error while creating Dataproc Session"

What are the steps that are missing and what is the solution to proceed to fix it? Thank you in advance

I have tried creating cluster on console but that dint work with session creation either. I would like to know the error details and solution to proceed with session creation.

I will be happy to hear back and appreciate your consideration.

Best Regards,
Siddiq Syed

i...@google.com

unread,
Oct 6, 2025, 7:53:07 PMOct 6
to Google Cloud Dataproc Discussions
Hi Siddiq,

Seems like you are running this on your local machine, you may need to authenticate with you GCP credentials using `gcloud auth login` command, and specify your GCP project and location/region explicitly:
```
spark = DataprocSparkSession.builder.projectId("my-project").location("my-region").appName("CustomSparkSession").dataprocSessionConfig(session).getOrCreate()
```
Reply all
Reply to author
Forward
0 new messages