Import problem
- Operating System version: docker image python:3.9 (debian bullseye)
- Firebase SDK version: firebase_admin-5.0.3
- Firebase Product: auth
- Python version: 3.9
- Pip version: 21.2.4
Steps to reproduce:
Hello everyone! I've got some import problem while importing auth module today:
source/tests/conftest.py:7: in <module>
import firebase_admin.auth
/usr/local/lib/python3.9/site-packages/firebase_admin/auth.py:22: in <module>
from firebase_admin import _auth_client
/usr/local/lib/python3.9/site-packages/firebase_admin/_auth_client.py:20: in <module>
from firebase_admin import _auth_providers
/usr/local/lib/python3.9/site-packages/firebase_admin/_auth_providers.py:21: in <module>
from firebase_admin import _auth_utils
/usr/local/lib/python3.9/site-packages/firebase_admin/_auth_utils.py:23: in <module>
from firebase_admin import _utils
/usr/local/lib/python3.9/site-packages/firebase_admin/_utils.py:23: in <module>
import httplib2
/usr/local/lib/python3.9/site-packages/httplib2/__init__.py:52: in <module>
from . import auth
/usr/local/lib/python3.9/site-packages/httplib2/auth.py:20: in <module>
auth_param_name = token.copy().setName("auth-param-name").addParseAction(pp.downcaseTokens)
E AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'
Relevant Code:
import firebase_admin.auth
Looks like it is also connected with this libs:
httplib2 0.20.1 requires pyparsing<3,>=2.4.2, but you'll have pyparsing 3.0.1 which is incompatible.
Exactly the same problem popped up today at our company.
-
firebase-admin==5.0.3
-
python version: python-3.8.12
Downgrading firebase-admin to 5.0.2 or 5.0.1 had no effect
same issue here. Any work around ? Should I downgrade the httplib2 @eremeevfd ?
Fixed by adding pyparsing==2.4.7 in my requirements.txt @RRaideRR @eremeevfd
Fixed by adding
pyparsing==2.4.7in my requirements.txt @RRaideRR @eremeevfd
I can confirm that this works.
Thanks for reporting this folks (and the workaround). Looking at the implementation, it seems we have a direct import on httplib2 from one file, and therefore we should probably specify a version constraint on that dependency.
In any case, do you know how pyparsing 3.x ended up in your dependency chain? Looking at httplib2 I see they are still restricting pyparsing to 2.x:
https://github.com/httplib2/httplib2/blob/dce3376fc25775451ce93e2456806459f4cec0df/requirements.txt#L1
Fixed by adding pyparsing==2.4.7 in my requirements.txt @RRaideRR @eremeevfd
I can confirm also, but I tried to add pyparsing < 3 and it worked also :)
@hiranya911
I have several libs dependending on pyparsing and with version set like required: >=2.0.2:
pytest-xdist==2.4.0
- pytest [required: >=6.0.0, installed: 6.2.5]
- packaging [required: Any, installed: 21.0]
- pyparsing [required: >=2.0.2, installed: 2.4.7]
- pytest-forked [required: Any, installed: 1.3.0]
- pytest [required: >=3.10, installed: 6.2.5]
- packaging [required: Any, installed: 21.0]
- pyparsing [required: >=2.0.2, installed: 2.4.7]
pytest-django==4.4.0
- pytest [required: >=5.4.0, installed: 6.2.5]
- packaging [required: Any, installed: 21.0]
- pyparsing [required: >=2.0.2, installed: 2.4.7]
So for all pytest dependant packages that will be true.
Also some google-cloud libraries also have dependency on pyparsing through module packaging.
So it looks like that all libs have packaging in common which limits only lower version of pyparsing
This is now being tracked at https://github.com/httplib2/httplib2/issues/207. Hopefully they fix it soon.
@hiranya911 issue in httplib2 is closed now