1

I made a script that sends data to Firestore. On my Mac the script works, but when I try to run it on my Raspberry pi I get this error message. I tried to reinstall google-cloud-firestore but it does't work.

Can anybody help me.

The code:

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

cred = credentials.Certificate("serviceAccountKey.json")
firebase_admin.initialize_app(cred)

db = firestore.client()

def sendDataToFirestore(username, shifts, upload):
    scedule = {}

    for shift in shifts:
        date = shift.split()[0]
        scedule[date] = shift
    if (upload == True):
        try:
            print("Send data to database...")
            db.collection("Users").document(username).set({'Last update': firestore.SERVER_TIMESTAMP, 'Scedule': scedule})
            print("Succes!")
        except Exception as e:
            print(e)
    else:
        print("Data is NOT send to the database")

Error message (Raspberry pi):

pi@raspberrypi:~ $ sudo python3 /home/pi/Documents/PlanningServer/Scrapper.py
Traceback (most recent call last):
  File "/home/pi/Documents/PlanningServer/Scrapper.py", line 8, in <module>
    from FirestoreDatabase import sendDataToFirestore
  File "/home/pi/Documents/PlanningServer/FirestoreDatabase.py", line 10, in <module>
    from google.cloud import firestore
  File "/usr/local/lib/python3.9/dist-packages/google/cloud/firestore.py", line 18, in <module>
    from google.cloud.firestore_v1 import __version__
  File "/usr/local/lib/python3.9/dist-packages/google/cloud/firestore_v1/__init__.py", line 30, in <module>
    from google.cloud.firestore_v1._helpers import GeoPoint
  File "/usr/local/lib/python3.9/dist-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.9/dist-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.9/dist-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/usr/local/lib/python3.9/dist-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/usr/local/lib/python3.9/dist-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: /usr/local/lib/python3.9/dist-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so: undefined symbol: __atomic_exchange_8
W_Surenbroek
  • 113
  • 1
  • 8
  • 1
    Does this answer your question? [ImportError: Failed to import the Cloud Firestore library for Python](https://stackoverflow.com/questions/48264536/importerror-failed-to-import-the-cloud-firestore-library-for-python) – xBurnsed Nov 16 '21 at 16:34
  • Hey @xBurnsed, Thanks for your response. I've followed the steps of your link and the problem is partially solved. I get a new error message. I've edit the code above with the new error message. Do you know what to do? – W_Surenbroek Nov 16 '21 at 17:16
  • Check [this](https://github.com/grpc/grpc/issues/25720). Apparently it is a reported and known issue, and there are two possible workarounds. – xBurnsed Nov 17 '21 at 11:56

0 Answers0