I have deployed a python code in Google App Engine.In my code,tried to import firebase_admin,but it shows following error,

import firebase_admin ImportError: No module named firebase_admin 

hello.py

import firebase_admin from firebase_admin import credentials from firebase_admin import db 

I tried simple python code using Terminal: hello.py

import firebase_admin print firebase_admin 

Output in terminal:

~/Desktop$ python hello.py <module 'firebase_admin' from '/usr/local/lib/python2.7/dist-packages/firebase_admin/__init__.pyc'> 
9

6 Answers

Install "firebase-admin" by pip3 install firebase-admin

Firstly, confirming your package path of executing program.

enter image description here

Secondly, Perferences --> Project Interpreter ,Make sure the Package install correct path enter image description here

Anyway, you should use correct python which is installed the packageenter image description here

Per Hiranya Jayathilaka's comment, third party libraries must be vendored into Google App Engine applications.

I was trying to connect cloud firestore through python-admin-sdk using Visual Studio Code which gave me same error

Working environment:

  1. Ubuntu 20.04
  2. Python 3.8.5
  3. firebase-admin 5.0.0
  4. Visual Studio Code

Resolution by re-installing PyLance extension in Visual Studio Code.

After unsuccessfully trying all incarnations of pip to install firebase_admin, what worked for me was adding firebase_admin in the requirements.txt file then run pip install -r requirements.txt

For some reason beyond my understanding, firebase_admin appears to work when installed by referencing the requirements.txt file but not when running pip directly.

update your

firebase_admin

to the latest version . this will solve the issue . if nit rename

firebase.py

to some other name... Its working

just not use

firebase.py

as a name for your project and it will work

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy