Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-6863

PhoenixDB 1.2+ doesn't work with Python2 on some systems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Workaround
    • python-phoenixdb-1.2.1
    • None
    • python
    • None
    • Hide
      When using an older 3.x version of the python protobuf library, and it uses the 'python' implementation instead of the 'cpp' implementation, phoenixdb will fail with the following error message:
      AttributeError: 'NoneType' object has no attribute 'enum_types_by_name'

      This usually happens when running on Python 2, as 3.17.3 is the last protobuf python library version that supports Python 2.

      To work around the problem, install the C protobuf library "libprotobuf.so" on the system, then reinstall the python protobuf library with the
      "pip uninstall protobuf;pip install protobuf"
      command.

      The protobuf C library is available pre-packaged in most distributions.
      Show
      When using an older 3.x version of the python protobuf library, and it uses the 'python' implementation instead of the 'cpp' implementation, phoenixdb will fail with the following error message: AttributeError: 'NoneType' object has no attribute 'enum_types_by_name' This usually happens when running on Python 2, as 3.17.3 is the last protobuf python library version that supports Python 2. To work around the problem, install the C protobuf library "libprotobuf.so" on the system, then reinstall the python protobuf library with the "pip uninstall protobuf;pip install protobuf" command. The protobuf C library is available pre-packaged in most distributions.

    Description

      On some systems we hit a protobuf bug which causes the following error when importing phoenixdb:

      (env) [root@aglhue0124-1 ~]# python
      Python 2.7.5 (default, Jul 13 2018, 13:06:57) 
      [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import phoenixdb
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/opt/cloudera/parcels/CDH-7.2.17-1.cdh7.2.17.p0.36938352/lib/hue/build/env/lib/python2.7/site-packages/phoenixdb-1.2.1-py2.7.egg/phoenixdb/__init__.py", line 19, in <module>
          from phoenixdb import errors, types
        File "/opt/cloudera/parcels/CDH-7.2.17-1.cdh7.2.17.p0.36938352/lib/hue/build/env/lib/python2.7/site-packages/phoenixdb-1.2.1-py2.7.egg/phoenixdb/types.py", line 21, in <module>
          from phoenixdb.avatica.proto import common_pb2
        File "/opt/cloudera/parcels/CDH-7.2.17-1.cdh7.2.17.p0.36938352/lib/hue/build/env/lib/python2.7/site-packages/phoenixdb-1.2.1-py2.7.egg/phoenixdb/avatica/__init__.py", line 16, in <module>
          from .client import AvaticaClient  # noqa: F401
        File "/opt/cloudera/parcels/CDH-7.2.17-1.cdh7.2.17.p0.36938352/lib/hue/build/env/lib/python2.7/site-packages/phoenixdb-1.2.1-py2.7.egg/phoenixdb/avatica/client.py", line 27, in <module>
          from phoenixdb.avatica.proto import common_pb2, requests_pb2, responses_pb2
        File "/opt/cloudera/parcels/CDH-7.2.17-1.cdh7.2.17.p0.36938352/lib/hue/build/env/lib/python2.7/site-packages/phoenixdb-1.2.1-py2.7.egg/phoenixdb/avatica/proto/common_pb2.py", line 36, in <module>
          _STATEMENTTYPE = DESCRIPTOR.enum_types_by_name['StatementType']
      AttributeError: 'NoneType' object has no attribute 'enum_types_by_name'
      

      There are several error reports for this behaviour with the new using the files generated by the new protoc with python2, but the fix is not available in a version that is compatible with Python2.

      We don't see this error when running our dockerized test suite with Python2.

      We need to understand the issue, and figure out a solution.

      Attachments

        Activity

          People

            stoty Istvan Toth
            stoty Istvan Toth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: