'ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module
Trying to integrate the Google firestore API in my python program
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/firebase_admin/firestore.py", line 22, in <module>
from google.cloud import firestore # pylint: disable=import-error,no-name-in-module
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore/__init__.py", line 18, in <module>
from google.cloud.firestore_v1 import __version__
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/__init__.py", line 30, in <module>
from google.cloud.firestore_v1._helpers import GeoPoint
File "/home/pi/.local/lib/python3.7/site-packages/google/cloud/firestore_v1/_helpers.py", line 22, in <module>
from google.api_core import gapic_v1
File "/home/pi/.local/lib/python3.7/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
from google.api_core.gapic_v1 import config
File "/home/pi/.local/lib/python3.7/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
import grpc
File "/usr/local/lib/python3.7/dist-packages/grpc/__init__.py", line 22, in <module>
from grpc import _compression
File "/usr/local/lib/python3.7/dist-packages/grpc/_compression.py", line 15, in <module>
from grpc._cython import cygrpc
ImportError: /lib/arm-linux-gnueabihf/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/python3.7/dist-packages/grpc/_cython/cygrpc.cpython-37m-arm-linux-gnueabihf.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/Code/main.py", line 10, in <module>
from firebase_admin import firestore
File "/home/pi/.local/lib/python3.7/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 have this error and have tried every option I have found
I installed the firebase-admin module:
pip3 insstall --upgrade -t libs firebase-admin
I installed grpc:
pip3 install grpcio
I installed google-cloud-core and google-cloud-firestore:
pip3 install google-cloud-core
pip3 install google-cloud-firestore
I even tried uninstalling and reinstalling all of these modules. But nothing seems to be working. Any advice would be appreciated.
Solution 1:[1]
Generally, it advised to install packages using python -m
command instead of simply pip
or pip3
.
Try installing as follows:
python3.7 -m pip install google-cloud-firestore
Additionally, I would recommend using a virtual environment.
# Create a virtual environment using Python3.7
$ python3.7 -m venv env
# Activate the virtual environment
$ source env/bin/activate
# Install dependencies
(env) $ python3.7 -m pip install google-cloud-firestore
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mariatta |