Skip to content

TypeError: Descriptors cannot not be created directly #64

@ezhiljohnson7

Description

@ezhiljohnson7

Error while creating the docker container. Here it is -

docker run -it -p 5000:5000 max-image-resolution-enhancer

Traceback (most recent call last):
File "app.py", line 18, in
from api import ModelMetadataAPI, ModelPredictAPI
File "/home/max/api/init.py", line 17, in
from .metadata import ModelMetadataAPI # noqa
File "/home/max/api/metadata.py", line 17, in
from core.model import ModelWrapper
File "/home/max/core/model.py", line 28, in
from core.srgan_controller import SRGAN_controller
File "/home/max/core/srgan_controller.py", line 21, in
import tensorflow as tf
File "/opt/conda/lib/python3.7/site-packages/tensorflow/init.py", line 41, in
from tensorflow.python.tools import module_util as _module_util
File "/opt/conda/lib/python3.7/site-packages/tensorflow/python/init.py", line 40, in
from tensorflow.python.eager import context
File "/opt/conda/lib/python3.7/site-packages/tensorflow/python/eager/context.py", line 32, in
from tensorflow.core.framework import function_pb2
File "/opt/conda/lib/python3.7/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/opt/conda/lib/python3.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/opt/conda/lib/python3.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "/opt/conda/lib/python3.7/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/opt/conda/lib/python3.7/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 42, in
serialized_options=None, file=DESCRIPTOR),
File "/opt/conda/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 560, in new
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not 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

What would be the best fix? Any help will be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions