Passing requirements.txt to Google Cloud Pyspark Batch Job

Viewed 31

I am trying to run a pyspark script as through a Google Dataproc Batch Job.

My script should connect to firestore to collect some data from there, so I need to access the library firebase-admin. When I run the script on Google Cloud through the following command:

gcloud dataproc batches submit \
        --project {PROJECT} \
        --region europe-west1 \
        --subnet {SUBNET} \
        pyspark spark_image_matching/main.py \
        --jars=gs://spark-lib/bigquery/spark-bigquery-latest_2.12.jar \
        --deps-bucket={DEPS_BUCKET} 

I receive the following error:

Traceback (most recent call last):
  File "/tmp/srvls-batch-0127aaf6-a438-4439-af56-beb1a66f45ed/main.py", line 4, in <module>
    import firebase_admin
ModuleNotFoundError: No module named 'firebase_admin'

I already tried creating a setup.py file to generate an .egg file that specifies the dependency along with the --py-files flag. This idea was highly inspired by this repo:

http://www.restez-en-bonne-sante-leh.com/?_=%2FGoogleCloudPlatform%2Fdataproc-templates%2Fblob%2Fmain%2Fpython%2Fsetup.py%23BQyskaWdLgo6VQOkV2YyLaeS

0 Answers
Related