Cannot import tensorflow after latest tensorboard release: TypeError: Descriptors cannot not be created directly
@albertvillanova Thanks for reporting the issue.

I have tried installing `tensorflow==2.3.0` and `tensorboard==2.12` and was able to import tensorflow without any error.

Please find the gist [here](https://colab.research.google.com/gist/pjpratik/9d7f805f3e64536f1531cd732c4b3980/59665.ipynb).  Could you please verify and confirm the same. Thanks! Hi @pjpratik, thanks for your answer and for having tried to reproduce the bug.

Please note that I get the error when trying to install tensorflow-2.3.0 in a completely empty Python environment.

You are not able to reproduce the bug because in the Colab Python environment, you have `protobuf-3.19.6` already installed from the beginning, which fulfills:
- protobuf>=3.9.2 from tensorflow
- protobuf>=3.19.6 from tensorboard

and hence it is not updated.

However, if you start with a completely empty Python environment, the requirements above resolve to installing `protobuf-4.21.12` and then you get the bug.

Also note that there is no problem with `protobuf-3.20.3`. These are the dependency packages installed in an empty Python environment, when installing `tensorflow-2.3.0`:
```
Successfully installed MarkupSafe-2.1.2 absl-py-1.4.0 astunparse-1.6.3 cachetools-5.3.0 charset-normalizer-3.0.1 gast-0.3.3 google-auth-2.16.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.51.1 h5py-2.10.0 idna-3.4 importlib-metadata-6.0.0 keras-preprocessing-1.1.2 markdown-3.4.1 numpy-1.18.5 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-4.21.12 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.28.2 requests-oauthlib-1.3.1 rsa-4.9 scipy-1.4.1 six-1.16.0 tensorboard-2.12.0 tensorboard-data-server-0.7.0 tensorboard-plugin-wit-1.8.1 tensorflow-2.3.0 tensorflow-estimator-2.3.0 termcolor-2.2.0 urllib3-1.26.14 werkzeug-2.2.2 wrapt-1.14.1 zipp-3.13.0
``` @albertvillanova Thanks for the clarification.

I was able to reproduce this issue after installing protobuf-4.21.12.  Please find the gist [here](https://colab.research.google.com/gist/pjpratik/32e420ffd7e93c16b29cd0c4f6069d66/59665.ipynb).

@SuryanarayanaY Could you please look into this issue. Thanks! Also note that there was no issue before the `tensorboard-2.12.0` release, because in that case pip resolved to `protobuf-3.20.3`:
```
pip install "tensorflow==2.3.0" "tensorboard<2.12.0"
```
```
Successfully installed MarkupSafe-2.1.2 absl-py-1.4.0 astunparse-1.6.3 cachetools-5.3.0 charset-normalizer-3.0.1 gast-0.3.3 google-auth-2.16.0 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.51.1 h5py-2.10.0 idna-3.4 importlib-metadata-6.0.0 keras-preprocessing-1.1.2 markdown-3.4.1 numpy-1.18.5 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-3.20.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.28.2 requests-oauthlib-1.3.1 rsa-4.9 scipy-1.4.1 six-1.16.0 tensorboard-2.11.2 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-2.3.0 tensorflow-estimator-2.3.0 termcolor-2.2.0 urllib3-1.26.14 werkzeug-2.2.2 wrapt-1.14.1 zipp-3.13.0
``` Hi, Thanks for opening the issue. 
We have upgraded the protobuf dependency to 3.21.9 (4.21.9) for python from Tensorflow version 2.12, which was long awaited ask.
For Tensorflow and Tensorboard 2.12 version, the protobuf minimum version requirement is `'protobuf>=3.20.3,<5.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5'`.
For any older Tensorflow version and new Tensorboard version the only version which acts as bridge between both is 3.20.3, which is working fine in your case.
Once the Tensorflow 2.12 is released, you can use Tensorboard 2.12 without any package conflict.  This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Thank you.
 Thanks @sachinprasadhs. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59665">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/59665">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

binary

### Tensorflow Version

2.3.0

### Custom Code

No

### OS Platform and Distribution

Linux Ubuntu 20.04.5 LTS

### Mobile device

_No response_

### Python version

3.8.16

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
Since tensorboard-2.12.0 release, we cannot install and then import tensorflow-2.3.0.
```


### Standalone code to reproduce the issue

```shell
pip install tensorflow==2.3.0
python -c "import tensorflow"
```


### Relevant log output

```shell
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 32, in <module>
    from tensorflow.core.framework import function_pb2
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/core/framework/function_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File ".../venv-py38-tf/lib/python3.8/site-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File ".../venv-py38-tf/lib/python3.8/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
```
</details>