Summary
pyrebase4 is the package bringing in the deprecated gcloud dependency.
Use firebase-admin instead.
Replace pyrebase4 with the official firebase-admin SDK:
poetry remove pyrebase4
poetry add firebase-admin
Pros:
- Officially maintained by Google
- No deprecated dependencies
- Better performance and features
Cons:
Note:
pyrebase4 is Abandoned
The last release (v4.7.1) was in 2019
Its dependency gcloud (v0.18.3) is also abandoned
Issue:
The warning comes from gcloud (v0.18.3), which is a dependency of pyrebase4 (v4.7.1)
gcloud uses the deprecated pkg_resources API from setuptools
UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import get_distribution
poetry show --tree | grep -A 5 -B 5 gcloud
│ │ └── six >=1.5
│ └── pytz >=2020.1
└── python-dateutil >=2.7.3
└── six >=1.5
pyrebase4 4.7.1 A simple python wrapper for the Firebase API with current deps
├── gcloud >=0.18.3
│ ├── gax-google-logging-v2 >=0.8.0,<0.9dev
│ │ ├── google-gax >=0.12.5,<0.13.0
│ │ │ ├── future >=0.15.2
│ │ │ ├── grpcio >=1.0rc1
│ │ │ ├── oauth2client >=1.5.2
Tasks
Previous format:
import pyrebase
config = {
"apiKey": "YOUR_API_KEY",
"authDomain": "YOUR_PROJECT.firebaseapp.com",
"databaseURL": "https://YOUR_PROJECT.firebaseio.com",
"storageBucket": "YOUR_PROJECT.appspot.com"
}
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
user = auth.sign_in_with_email_and_password(email, password)
New format:
import firebase_admin
from firebase_admin import credentials
cred = credentials.Certificate("path/to/serviceAccountKey.json") # Download from Firebase Console
firebase_admin.initialize_app(cred)
from firebase_admin import auth
No direct email/password sign-in in admin SDK (server-side)
user = auth.get_user_by_email(email) # Get existing user
OR create user:
user = auth.create_user(email=email, password=password)
Summary
pyrebase4is the package bringing in the deprecatedgclouddependency.Use
firebase-admininstead.Replace pyrebase4 with the official firebase-admin SDK:
Pros:
Cons:
Note:
pyrebase4 is Abandoned
The last release (v4.7.1) was in 2019
Its dependency gcloud (v0.18.3) is also abandoned
Issue:
The warning comes from gcloud (v0.18.3), which is a dependency of pyrebase4 (v4.7.1)
gcloud uses the deprecated pkg_resources API from setuptools
Tasks
Previous format:
import pyrebase
config = {
"apiKey": "YOUR_API_KEY",
"authDomain": "YOUR_PROJECT.firebaseapp.com",
"databaseURL": "https://YOUR_PROJECT.firebaseio.com",
"storageBucket": "YOUR_PROJECT.appspot.com"
}
firebase = pyrebase.initialize_app(config)
auth = firebase.auth()
user = auth.sign_in_with_email_and_password(email, password)
New format:
import firebase_admin
from firebase_admin import credentials
cred = credentials.Certificate("path/to/serviceAccountKey.json") # Download from Firebase Console
firebase_admin.initialize_app(cred)
from firebase_admin import auth
No direct email/password sign-in in admin SDK (server-side)
user = auth.get_user_by_email(email) # Get existing user
OR create user:
user = auth.create_user(email=email, password=password)