Trying to integrate Google firestore API at python server
...
File "/home/daffolap-355/repos/subscriptions/appvendor/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.
I get this error here:
from firebase_admin import credentials, auth, firestore
I installed the firebase-admin module:
pip install --upgrade -t libs firebase-admin
And run the app
dev_appserver app.yaml
Google Cloud Firestore requires grpc.
pip install grpcio
However, there are additional steps depending on your OS. Check out https://github.com/grpc/grpc/tree/master/src/python/grpcio
To solve the "google-cloud-firestore" module error do this:
- pip install google-cloud-core
- pip install google-cloud-firestore
And then import like this:
- import os
- import firebase_admin
- from firebase_admin import credentials
- from google.cloud import firestore
- from firebase_admin import firestore
This worked for me. Try uninstalling and re-installing google-cloud-firestore
Uninstall "google-cloud-firestore" using pip
pip uninstall google-cloud-firestoreRe-install it using pip again
pip install google-cloud-firestore
来源:https://stackoverflow.com/questions/48264536/importerror-failed-to-import-the-cloud-firestore-library-for-python