firebase / firebase-admin-python

Firebase Admin Python SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.03k stars 320 forks source link

sending data from Raspberry pi 4 to firebase firestore #612

Closed m0d9 closed 2 years ago

m0d9 commented 2 years ago

I am trying to send data from raspberry pi 4 to firebase firestore, here is the code

import firebase_admin
from  firebase_admin import credentials
from firebase_admin import firestore
#from google.cloud import firestore

# initializations 

cred = credentials.Certificate("/home/pi/Desktop/qu-evergreen-firebase-adminsdk-pcu2s-73526791b5.json")
#firebase_admin.initialize_app(cred)
db = firestore.client()

#adding first data
doc_ref = db.collection('employee').document('empdoc')

doc_ref.set({

    'name':'Try',
    'lname':'??',
    'age':25

})

And here is the problem that I get:

pi@raspberrypi:~/Senior $  /usr/bin/env /usr/bin/python3.10 /home/pi/.vscode/extensions/ms-python.python-2022.0.1814523869/pythonFiles/lib/python/debugpy/launcher 40063 -- /home/pi/Senior/test1.py 
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/firebase_admin/firestore.py", line 22, in <module>
    from google.cloud import firestore # pylint: disable=import-error,no-name-in-module
  File "/usr/local/lib/python3.10/site-packages/google/cloud/firestore.py", line 18, in <module>
    from google.cloud.firestore_v1 import __version__
  File "/usr/local/lib/python3.10/site-packages/google/cloud/firestore_v1/__init__.py", line 30, in <module>
    from google.cloud.firestore_v1._helpers import GeoPoint
  File "/usr/local/lib/python3.10/site-packages/google/cloud/firestore_v1/_helpers.py", line 22, in <module>
    from google.api_core import gapic_v1  # type: ignore
  File "/usr/local/lib/python3.10/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
    from google.api_core.gapic_v1 import config
  File "/usr/local/lib/python3.10/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/usr/local/lib/python3.10/site-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/usr/local/lib/python3.10/site-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.33' not found (required by /usr/local/lib/python3.10/site-packages/grpc/_cython/cygrpc.cpython-310-arm-linux-gnueabihf.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/Senior/test1.py", line 3, in <module>
    from firebase_admin import firestore
  File "/usr/local/lib/python3.10/site-packages/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 tried many solutions like 1- pip install grpcio 2- pip install google-cloud-core 3- pip install google-cloud-firestore 4- pip install firebase-admin 5- Updated python to latest version And I still get the same error so anyone can help

google-oss-bot commented 2 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

lahirumaramba commented 2 years ago

Please see #606

gtgkartik commented 1 year ago

Hey We have tried the same, did you do it on a virtual environment?