Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: Failed to import the Cloud Firestore library for Python

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

like image 296
Anubhav Dhawan Avatar asked Jan 15 '18 14:01

Anubhav Dhawan


People also ask

What is firestore in GCP?

Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Firestore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.


Video Answer


3 Answers

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

like image 168
Chayapol Avatar answered Sep 20 '22 05:09

Chayapol


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
like image 30
MAGA PILL Avatar answered Sep 17 '22 05:09

MAGA PILL


This worked for me. Try uninstalling and re-installing google-cloud-firestore

  1. Uninstall "google-cloud-firestore" using pip

       pip uninstall google-cloud-firestore
    
  2. Re-install it using pip again

       pip install google-cloud-firestore
    
like image 44
Ravneet Sohi Avatar answered Sep 21 '22 05:09

Ravneet Sohi