Open
Description
System information
- Have I written custom code (as opposed to using a stock example script
provided in TensorFlow Model Analysis): No - OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 22.04
- TensorFlow Model Analysis installed from (source or binary): Source
- TensorFlow Model Analysis version (use command below): Commit
83cd413a68e8d743aca4b1319304cc525a736e88
(not unique to this commit) - Python version: 3.11
- Jupyter Notebook version: N/A
- Exact command to reproduce:
$ python3.11 -m venv .venv $ source .venv/bin/activate $ pip install . $ python -c "import tensorflow_model_analysis as tfma"
Describe the problem
There seems to be an issue with Python 3.11 support. For Python 3.11, protobuf 4.25.2 is installed, but the tfma protobuf modules seem to require protobuf 3.19 or earlier. This causes tfma to crash on import (shown below).
Source code / logs
$ python -c "import tensorflow_model_analysis as tfma"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/tmp.PTkD1g2WBK/model-analysis/tensorflow_model_analysis/__init__.py", line 30, in <module>
from tensorflow_model_analysis.sdk import *
File "/tmp/tmp.PTkD1g2WBK/model-analysis/tensorflow_model_analysis/sdk.py", line 60, in <module>
from tensorflow_model_analysis.proto.config_pb2 import AggregationOptions
File "/tmp/tmp.PTkD1g2WBK/model-analysis/tensorflow_model_analysis/proto/config_pb2.py", line 35, in <module>
_descriptor.EnumValueDescriptor(
File "/tmp/tmp.PTkD1g2WBK/model-analysis/.venv/lib/python3.11/site-packages/google/protobuf/descriptor.py", line 789, in __new__
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
1. Downgrade the protobuf package to 3.20.x or lower.
2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates