Search code examples
pythonpyparsing

unknown version in python library pyparsing


I am trying to install airnotifier on my machine, I am getting this error

My python version is 3.6

PS C:\airnotifier> python app.py
Traceback (most recent call last):
  File "app.py", line 32, in <module>
    from pushservices.bootstrap import init_messaging_agents
  File "C:\airnotifier\pushservices\bootstrap.py", line 4, in <module>
    from .fcm import FCMClient
  File "C:\airnotifier\pushservices\fcm.py", line 5, in <module>
    from oauth2client.service_account import ServiceAccountCredentials
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\service_account.py", line 25, in <module>
    from oauth2client import client
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\client.py", line 39, in <module>
    from oauth2client import transport
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\transport.py", line 17, in <module>
    import httplib2
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 52, in <module>
    from . import auth
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\auth.py", line 4, in <module>
    import pyparsing as pp
  File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyparsing\__init__.py", line 130, in <module>
    __version__ = __version_info__.__version__
AttributeError: 'version_info' object has no attribute '__version__'

Solution

  • I received the same error and I'm also in Python 3.6.0 ...

    AttributeError: 'version_info' object has no attribute '__version__'
    

    If you want to dig a little more, you can type this in your console and detect which package is using this dependency.

    > pip show pyparsing
    

    In my case the output was something like this, indicating that packaging:

    • Name: pyparsing
    • Version: 2.4.7
    • Summary: Python parsing module
    • License: MIT License
    • Location:
    • Requires:
    • Required-by: packaging

    To fix it, you can go with the suggestion from PaulMcG

    pip install pyparsing==2.4.7
    

    Update 2022-Jun-03:

    Reference to the issue

    https://github.com/pyparsing/pyparsing/releases/tag/pyparsing_3.0.8

    Note says:

    API CHANGE: modified pyproject.toml to require Python version 3.6.8 or later for pyparsing 3.x. Earlier minor versions of 3.6 fail in evaluating the version_info class (implemented using typing.NamedTuple). If you are using an earlier version of Python 3.6, you will need to use pyparsing 2.4.7.