ImportError: Failed to import the Cloud Firestore

2019-02-24 13:12发布

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

2条回答
ゆ 、 Hurt°
2楼-- · 2019-02-24 13:13

Google Cloud Firestore requires grpc.

pip install grpcio

However, there are additional steps depending on your OS. Check out https://github.com/grpc/grpc/blob/master/INSTALL.md

查看更多
Explosion°爆炸
3楼-- · 2019-02-24 13:18

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
查看更多
登录 后发表回答