user2300846
user2300846

Reputation: 155

Failed to import the Cloud Firestore library for Python - Django Visual Studio

I am trying to use firebase in my python django project. This is on a windows machine using visual studio. I get the error "Failed to import the Cloud Firestore library for Python" when I try to import it:

import firebase_admin
from firebase_admin import firestore

I have tried everything I can find through google including:

  1. Manually installing grpcio
  2. Downgrading protobuff to various versions. This one actually just ends up with a different error depending on which version of protobuff I go with.
  3. Uninstalling and re-installing google-cloud-store and all other dependencies
  4. Re-installing and upgrading pip

And several other minor things over the course of the day that I can't recall. I am at a dead end after a full day of bashing my head against this. Any other solutions or even a direction to look in?

Here is installed packages list:

CacheControl             0.12.6
cachetools               4.1.1
certifi                  2020.6.20
cffi                     1.14.2
chardet                  3.0.4
defusedxml               0.6.0
diff-match-patch         20200713
Django                   2.2.16
django-import-export     2.3.0
docutils                 0.16
et-xmlfile               1.0.1
firebase-admin           4.3.0
google-api-core          1.22.2
google-api-python-client 1.12.1
google-auth              1.21.1
google-auth-httplib2     0.0.4
google-cloud-core        1.4.1
google-cloud-firestore   1.9.0
google-cloud-storage     1.31.0
google-crc32c            1.0.0
google-resumable-media   1.0.0
googleapis-common-protos 1.52.0
grpcio                   1.32.0
httplib2                 0.18.1
idna                     2.10
jdcal                    1.4.1
MarkupPy                 1.14
msgpack                  1.0.0
mysql-connector-python   8.0.21
odfpy                    1.4.1
openpyxl                 3.0.5
pip                      20.2.3
protobuf                 3.13.0
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pycparser                2.20
pytz                     2020.1
PyYAML                   5.3.1
requests                 2.24.0
rsa                      4.6
setuptools               50.3.0
six                      1.15.0
sqlparse                 0.3.1
stripe                   2.51.0
tablib                   2.0.0
uritemplate              3.0.1
urllib3                  1.25.10
xlrd                     1.2.0
xlwt                     1.3.0

Dunno if noteworthy, but when I try to do the imports like this as another post recommended:

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

I instead get "DLL load failed: The specified procedure could not be found." in descriptor.py for "rom google.protobuf.pyext import _message". I dunno if its related at all but figured id included the info.

Upvotes: 0

Views: 371

Answers (1)

user2300846
user2300846

Reputation: 155

Upgrading to python 3.7.8 fixed this issue for me.

Upvotes: 1

Related Questions