Reputation: 8071
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
Reputation: 11
I was trying to connect cloud firestore
through python-admin-sdk
using Visual Studio Code which gave me same error
Working environment:
- Ubuntu 20.04
- Python 3.8.5
- firebase-admin 5.0.0
- Visual Studio Code
Solution: Resolution by re-installing PyLance
extension in Visual Studio Code.
Upvotes: 1
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
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
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
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
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
Reputation: 55589
Per Hiranya Jayathilaka's comment, third party libraries must be vendored into Google App Engine applications.
Upvotes: 0
Reputation: 400
Firstly, confirming your package path of executing program.
Secondly, Perferences --> Project Interpreter ,Make sure the Package install correct path
Anyway, you should use correct python which is installed the package
Upvotes: 7
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