Skip to content

ModuleNotFoundError: No module named 'google.auth' #184

Closed
@FreakTheMighty

Description

@FreakTheMighty

[REQUIRED] Step 2: Describe your environment

  • Operating System version: amazonlinux Dockerfile
  • Firebase SDK version: v2.12.0
  • Library version: v2.12.0
  • Firebase Product: firestore

[REQUIRED] Step 3: Describe the problem

pip install doesn't appear to install all transitive dependencies. As a result I'm getting missing module errors when I from firebase_admin import firestore

Traceback (most recent call last):
  File "lib/firebase_admin/firestore.py", line 22, in <module>
    from google.cloud import firestore # pylint: disable=import-error,no-name-in-module
  File "lib/google/cloud/firestore.py", line 18, in <module>
    from google.cloud.firestore_v1beta1 import __version__
  File "lib/google/cloud/firestore_v1beta1/__init__.py", line 20, in <module>
    from google.cloud.firestore_v1beta1 import types
  File "lib/google/cloud/firestore_v1beta1/types.py", line 18, in <module>
    from google.api_core.protobuf_helpers import get_messages
  File "lib/google/api_core/protobuf_helpers.py", line 21, in <module>
    from google.protobuf import field_mask_pb2
ModuleNotFoundError: No module named 'google.protobuf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from firebase_admin import firestore
  File "lib/firebase_admin/firestore.py", line 28, in <module>
    raise ImportError('Failed to import the Cloud Firestore library for Python. Make sure '
ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.

Steps to reproduce:

I've created a dockerized reproduction of the problem:

  1. git clone https://github.com/FreakTheMighty/FirestoreImportIssue.git
  2. docker-compose run lambda bash test.sh
  3. Note the traceback

Relevant Code:

from firebase_admin import firestore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions