GoogleCloudPlatform / GoogleCloudPlatform/gsutil

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

Open
#1,819 8 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
918
Forks
335
PR merge metrics
No merged PRs in 30d

Description

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:

```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
0.875 from gslib.__main__ import main
0.875 File "/usr/local/lib/python3.13/site-packages/gslib/__main__.py", line 89, in
0.875 from gslib import wildcard_iterator
0.875 File "/usr/local/lib/python3.13/site-packages/gslib/wildcard_iterator.py", line 43, in
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
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
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
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
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the supplied Python 3.13 Dockerfile and `gsutil help`, then inspect `apitools/base/protorpclite/messages.py` and the import path shown in the traceback. Verify the compatibility issue around Enum definitions, and consider the work done when the command runs without `EnumDefinitionError` in the Docker reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.