close

[Solved] TypeError: Descriptors cannot not be created directly

I am trying to use TensorFlow But SomeHow I am facing the following error: 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. in Python. We are going to Learn about All Possible Solutions So Lets Get Start with This Article.

How TypeError: Descriptors cannot not be created directly Error Occurs?

I am trying to use TensorFlow But SomeHow I am facing following error:

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.

So here I am writing all the possible solutions that I have tried to resolve this error.

How To Solve TypeError: Descriptors cannot not be created directly?

  1. How To Solve TypeError: Descriptors cannot not be created directly?

    To Solve TypeError: Descriptors cannot not be created directly TensorFlow has Released the Latest version 2.9.1 On 23 May 2022 Just Update its Latest version and May Your error will be solved. You can use This Command: pip install tensorflow==2.9.1

  2. TypeError: Descriptors cannot not be created directly

    To Solve TypeError: Descriptors cannot not be created directly protobuf has recently Released the latest version and the Cause of this Update This error Occurs. All We Need to do is just Downgrade protobuf to 3.20.1 and Your error will be solved. To Downgrade protobuf Just Run This command in your terminal: pip install –upgrade “protobuf<=3.20.1” And Now, Your error must be solved Thanks.

Solution 1: Downgrade protobuf

protobuf has recently Released the latest version and the Cause of this Update This error Occurs. All We Need to do is just Downgrade protobuf to 3.20.1 and Your error will be solved. To Downgrade protobuf Just Run This command in your terminal.

pip install --upgrade "protobuf<=3.20.1"

Or You can Use Force

pip install 'protobuf<=3.20.1' --force-reinstall

And Now, Your error must be solved Thanks.

Solution 2: Update TensorFlow to the Latest version

TensorFlow has Released the Latest version 2.9.1 On 23 May 2022 Just Update its Latest version and May Your error will be solved. You can use This Command.

pip install tensorflow==2.9.1

Conclusion

It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment