add protobuf as depdencency of transformers
Author: mirekphd
Pull request: no

### Feature request

Perhaps protobuf should be added explicitly as a dependency of transformers?

### Motivation

Various `ImportError`s  that got solved (and not just by me - by tens of upvoters) by simply importing `protobuf` (latest or pinned). Examples (please extend the list if necessary):
* https://github.com/huggingface/transformers/issues/9515#issuecomment-869188308
* https://github.com/huggingface/transformers/issues/10020#issuecomment-953061330

### Your contribution

This issue can be reproduced in e.g. a Hugging Face example for e.g. DONUT document classifier using our latest CUDA 11.8 containers: `mirekphd/cuda-11.8-cudnn8-devel-ubuntu22.04:20230928`. Note that the official `nvidia/cuda/11.8.0-cudnn8-devel-ubuntu22.04:latest` containers seem to come with `protobuf` already preinstalled, so you won't reproduce the bug there.

Comments:
`protobuf` should already be a dependency of `sentencepiece` which is a need for many models (with correct error thrown in case it's not installed!)

Thanks for sharing a reproducible code snippet, this should help a lot in identifying what might be going on here.

This PR should help reduce significantly the need for `protobuf`: https://github.com/huggingface/transformers/pull/26483

> `protobuf` should already be a dependency of `sentencepiece` 

Sorry, but it seems that neither of them owns up to that relationship:)

As verified using `pipdeptree`:
```
!pip install pipdeptree 

!pipdeptree -p sentencepiece | grep protobuf

# show also reverse dep. of protobuf
!pipdeptree -r -p protobuf
```


> Thanks for sharing a reproducible code snippet, this should help a lot in identifying what might be going on here.

I hope my case is sufficiently generic...


One of the reasons can be that the latest `protobuf` still does not have a pre-compiled wheel for Python 3.10 (for Linux it has a universal "none-any" version, which is probably wrongly named):
https://pypi.org/project/protobuf/4.24.3/#files

And Python 3.10 was the one used (as bundled with Ubuntu 22.04) in those custom `mirekphd/cuda` containers that replicated the problem above (an in production containers we now use an even newer, and indeed faster version of Python 3.11). So if you install the reverse dependency (whether it is `sentencepiece` or something else), `pip` cannot find a candidate for that version of Python, so it does not get installed, Whereas when you install the missing `protobuf`directly, it ignores lack of pre-compiled wheel for the version, and downloads a random one (in this test it happens to be... the oldest supported by `protobuf` version of Python -  3.7, which as the only wheel has "linux" in its file name):

```
!pip install protobuf
Collecting protobuf
  Downloading protobuf-4.24.3-cp37-abi3-manylinux2014_x86_64.whl (311 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 311.6/311.6 KB 4.8 MB/s eta 0:00:00a 0:00:01
Installing collected packages: protobuf
Successfully installed protobuf-4.24.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
```
   

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.