Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'pyparsing' has no attribute 'downcaseTokens' #104

Closed
ray-ray opened this issue Oct 25, 2021 · 3 comments
Closed
Assignees

Comments

@ray-ray
Copy link

ray-ray commented Oct 25, 2021

Starting today, when I import googlecloudprofiler, I get this traceback;

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
    __import__(module)
  File "/app/collection/__init__.py", line 16, in <module>
    import googlecloudprofiler
  File "/usr/local/lib/python3.7/site-packages/googlecloudprofiler/__init__.py", line 19, in <module>
    from googlecloudprofiler import client
  File "/usr/local/lib/python3.7/site-packages/googlecloudprofiler/client.py", line 29, in <module>
    import google_auth_httplib2
  File "/usr/local/lib/python3.7/site-packages/google_auth_httplib2.py", line 23, in <module>
    import httplib2
  File "/usr/local/lib/python3.7/site-packages/httplib2/__init__.py", line 52, in <module>
    from . import auth
  File "/usr/local/lib/python3.7/site-packages/httplib2/auth.py", line 20, in <module>
    auth_param_name = token.copy().setName("auth-param-name").addParseAction(pp.downcaseTokens)
AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'

Looks like the latest pyparsing release changed the name of these functions:
https://pyparsing-docs.readthedocs.io/en/latest/whats_new_in_3_0_0.html#other-discontinued-features

upcaseTokens and downcaseTokens - convert to using pyparsing_common.upcase_tokens and downcase_tokens
@ray-ray
Copy link
Author

ray-ray commented Oct 25, 2021

As a workaround, I having pinned pyparsing in my requirements.txt:

pyparsing==2.4.7

@amchiclet amchiclet self-assigned this Oct 28, 2021
@amchiclet
Copy link

Thanks for reporting this. Looks like the root cause is being tracked here.

We can possibly add some workaround in cloud-profiler-python while waiting for that to be resolved.

I'm currently occupied with other tasks, but I'll do my best to take a look at this in 1-2 weeks. If your workaround starts breaking badly, please let us know.

@punya
Copy link
Collaborator

punya commented Sep 28, 2022

I think this is fixed in httplib 0.20.2 (httplib2/httplib2#207 (comment)). I was able to import googlecloudprofiler successfully after installing google-cloud-profiler in a clean virtualenv.

Recording versions for posterity:

$ pip freeze
cachetools==5.2.0
certifi==2022.9.24
charset-normalizer==2.1.1
google-api-core==2.10.1
google-api-python-client==2.63.0
google-auth==2.12.0
google-auth-httplib2==0.1.0
google-cloud-profiler==4.0.0
googleapis-common-protos==1.56.4
httplib2==0.20.4
idna==3.4
protobuf==4.21.6
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.9
requests==2.28.1
rsa==4.9
six==1.16.0
uritemplate==4.1.1
urllib3==1.26.12

@punya punya closed this as completed Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants