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

apitools.base.protorpclite.messages.EnumDefinitionError: May only use integers in Enum definitions. Found: __static_attributes__ = () error #1819

Open
ag-TJNII opened this issue Nov 27, 2024 · 4 comments

Comments

@ag-TJNII
Copy link

All commands on version 5.31 installed via pip are failing with a apitools.base.protorpclite.messages.EnumDefinitionError: May only use integers in Enum definitions. Found: __static_attributes__ = () error.

Take the following simplified Dockerfile:

FROM public.ecr.aws/docker/library/python:3-bullseye

RUN pip install gsutil
RUN pip freeze | grep gsutil && \
    gsutil help

The gsutil help fails during the build:

[+] Building 1.0s (6/6) FINISHED                                                                                                                                                                                              docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                    0.0s
 => => transferring dockerfile: 164B                                                                                                                                                                                                    0.0s
 => [internal] load metadata for public.ecr.aws/docker/library/python:3-bullseye                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                                                                         0.0s
 => [1/3] FROM public.ecr.aws/docker/library/python:3-bullseye                                                                                                                                                                          0.0s
 => CACHED [2/3] RUN pip install gsutil                                                                                                                                                                                                 0.0s
 => ERROR [3/3] RUN pip freeze | grep gsutil &&     gsutil help                                                                                                                                                                         0.9s
------                                                                                                                                                                                                                                       
 > [3/3] RUN pip freeze | grep gsutil &&     gsutil help:                                                                                                                                                                                    
0.571 gsutil==5.31
0.874 Traceback (most recent call last):
0.875   File "/usr/local/bin/gsutil", line 5, in <module>
0.875     from gslib.__main__ import main
0.875   File "/usr/local/lib/python3.13/site-packages/gslib/__main__.py", line 89, in <module>
0.875     from gslib import wildcard_iterator
0.875   File "/usr/local/lib/python3.13/site-packages/gslib/wildcard_iterator.py", line 43, in <module>
0.875     from gslib.third_party.storage_apitools import storage_v1_messages as apitools_messages
0.875   File "/usr/local/lib/python3.13/site-packages/gslib/third_party/storage_apitools/storage_v1_messages.py", line 20, in <module>
0.875     from apitools.base.protorpclite import message_types as _message_types
0.875   File "/usr/local/lib/python3.13/site-packages/apitools/base/protorpclite/message_types.py", line 25, in <module>
0.875     from apitools.base.protorpclite import messages
0.875   File "/usr/local/lib/python3.13/site-packages/apitools/base/protorpclite/messages.py", line 549, in <module>
0.875     class Variant(Enum):
0.875     ...<34 lines>...
0.875         SINT64 = 18
0.875   File "/usr/local/lib/python3.13/site-packages/apitools/base/protorpclite/messages.py", line 319, in __init__
0.875     raise EnumDefinitionError(
0.875     ...<2 lines>...
0.875         (attribute, value))
0.875 apitools.base.protorpclite.messages.EnumDefinitionError: May only use integers in Enum definitions.  Found: __static_attributes__ = ()
------
Dockerfile:4
--------------------
   3 |     RUN pip install gsutil
   4 | >>> RUN pip freeze | grep gsutil && \
   5 | >>>     gsutil help
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c pip freeze | grep gsutil &&     gsutil help" did not complete successfully: exit code: 1
@ag-TJNII
Copy link
Author

This appears to be an issue with Python 3.13. The following Dockerfile builds:

FROM public.ecr.aws/docker/library/python:3.12-bullseye                                                                                                                                                                                      
                                                                                                                                                                                                                                             
RUN pip install gsutil
RUN pip freeze | grep gsutil && \
    gsutil help

The Python version in use when successful is 3.12.7. 3.13.0 fails with the error in the opening comment.

@ag-TJNII ag-TJNII changed the title 5.31: apitools.base.protorpclite.messages.EnumDefinitionError: May only use integers in Enum definitions. Found: __static_attributes__ = () error apitools.base.protorpclite.messages.EnumDefinitionError: May only use integers in Enum definitions. Found: __static_attributes__ = () error Nov 27, 2024
@ag-TJNII
Copy link
Author

ag-TJNII commented Nov 27, 2024

Removed gsutil version from the topic as 5.27, which was the previously stable version I was running, also failed on Python 3.13.0 with the same error.

@kladiv
Copy link

kladiv commented Dec 2, 2024

+1 same issue on our side

@sameer-google
Copy link
Collaborator

The error you encountered is related to Python 3.13, which is not fully supported by gsutil at this time.

Supported Python Versions:
As per the gsutil installation documentation, gsutil supports Python versions 3.8 to 3.12.

Fix in gsutil 5.32:
This specific issue was addressed in gsutil version 5.32 with this commit. However, even with this fix, gsutil does not fully support Python 3.13.

Recommendation:
If you intend to use Python 3.13, migrating to gcloud storage is recommended. The gcloud storage command-line tool offers similar functionality, is actively maintained with broader compatibility and supports Python 3.13.

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