Ramprasad
Ramprasad

Reputation: 8071

Python Firebase issue No module named firebase_admin

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'>

Upvotes: 18

Views: 60479

Answers (10)

aarush babbar
aarush babbar

Reputation: 11

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

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

Upvotes: 1

Jaswanth Krishna
Jaswanth Krishna

Reputation: 1

to solve all the problems regarding this face_recognition module first I have installed cmake in the current working terminal of pycharm using pip install cmake then for the dlib I have used pip install dlib it showed me a error that failed to build wheel I have the installed the wheel from https://github.com/sachadee/Dlib I have done all this in python 3.9 and I have no issues in solving all these errors it is better to use python 3.9.0

Upvotes: 0

chris
chris

Reputation: 11

For me it worked when I changed my interpreter to an earlier version of Python: I went from 3.11.7.1 to 3.9.6

Upvotes: 1

mdeotti
mdeotti

Reputation: 121

For me the problem was that I installed using pip and not pip3.

After correctly installing firebase_admin I also included this on .zshrc:

export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" 
alias python=python3
alias pip=pip3

Bonus tip:

Check Python version on pyvenv.cfg file, make sure to update Python if necessary and set the latest version to default as described on the first line above. Make sure to replace @3.11 with your latest version.

Upvotes: 1

Jonas Soares
Jonas Soares

Reputation: 1

Had the same issue here! Solved it by updating from python 3.7.9 to 3.9.13 All good now!!!

Upvotes: 0

wandesky
wandesky

Reputation: 102

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.

Upvotes: 0

snakecharmerb
snakecharmerb

Reputation: 55589

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

Upvotes: 0

ijas
ijas

Reputation: 359

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

Upvotes: 19

Yang MingHui
Yang MingHui

Reputation: 400

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

Upvotes: 7

Gautam Kumar
Gautam Kumar

Reputation: 1463

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

Upvotes: -7

Related Questions