firebase-admin-python icon indicating copy to clipboard operation
firebase-admin-python copied to clipboard

Import problem

Open eremeevfd opened this issue 4 years ago • 10 comments

  • 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

eremeevfd avatar Oct 25 '21 08:10 eremeevfd

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.

eremeevfd avatar Oct 25 '21 08:10 eremeevfd

Exactly the same problem popped up today at our company.

  • firebase-admin==5.0.3

  • python version: python-3.8.12

RRaideRR avatar Oct 25 '21 10:10 RRaideRR

Downgrading firebase-admin to 5.0.2 or 5.0.1 had no effect

RRaideRR avatar Oct 25 '21 10:10 RRaideRR

same issue here. Any work around ? Should I downgrade the httplib2 @eremeevfd ?

conglin avatar Oct 25 '21 11:10 conglin

Fixed by adding pyparsing==2.4.7 in my requirements.txt @RRaideRR @eremeevfd

conglin avatar Oct 25 '21 11:10 conglin

Fixed by adding pyparsing==2.4.7 in my requirements.txt @RRaideRR @eremeevfd

I can confirm that this works.

RRaideRR avatar Oct 25 '21 13:10 RRaideRR

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

hiranya911 avatar Oct 25 '21 17:10 hiranya911

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

eremeevfd avatar Oct 26 '21 05:10 eremeevfd

This is now being tracked at https://github.com/httplib2/httplib2/issues/207. Hopefully they fix it soon.

hiranya911 avatar Oct 27 '21 18:10 hiranya911

@hiranya911 issue in httplib2 is closed now

eremeevfd avatar Nov 18 '21 07:11 eremeevfd