1

I have a couple of firebase python files, one that writes to my database fine, and one that retrieves data from my firebase database no problem. They are both written in Python 3.5.3. I have a flask website that I am developing, as soon as I use the

import firebase_admin

in MyFlaskApp.py it throws up the error no module named firebase_admin and I get the following error.

flask.cli.NoAppException: While importing "TrialPage", an ImportError was 
raised:

Traceback (most recent call last):
File "/home/pi/Documents/WebFlask/venv/lib/python3.5/site- 
packages/flask/cli.py", line 236, in locate_app
__import__(module_name)
File "/home/pi/Documents/WebFlask/TrialPage.py", line 1, in <module>
from firebase_admin import firebase_admin
ImportError: No module named 'firebase_admin'

my other files work completely fine, I can understand why this wont work with my flask file. I have even tried creating a brand new MyFlaskApp.py file just incase something was corrupt with the existing file I am using. This did not work.

This error is thrown up regardless of whether the import firebase_admin is at the very top of my file or underneath my other imports, or in the middle of a function.

PrimitiveSource
  • 189
  • 4
  • 16
  • I'm afraid I'm running into the same issue as yours: https://stackoverflow.com/questions/56536650/firebase-admin-sdk-with-flask-throws-error-no-module-named-firebase-admin – shiouming Jun 11 '19 at 05:56

1 Answers1

0

The line from firebase_admin import firebase_admin suggests we're importing firebase_admin.py from firebase_admin package.

If we look into the firebase_admin package installed, we won't see a firebase_admin.py file.

I tried to replicate the error by intentionally using the same import line that you used and I can confirm that I get the same ImportError message.

I would suggest using the following import line instead:

import firebase_admin

Hope that helps!

johnsing
  • 141
  • 5