Wrong dependency: `"tensorflow-text<2.16"`
Author: d-kleine
Pull request: no
Labels: name: bug

### System Info

- `transformers` version: 4.50.0.dev0
- Platform: Windows-10-10.0.26100-SP0
- Python version: 3.10.11
- Huggingface_hub version: 0.29.1
- Safetensors version: 0.5.3
- Accelerate version: not installed
- Accelerate config: not found
- DeepSpeed version: not installed
- PyTorch version (GPU?): not installed (NA)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using distributed or parallel set-up in script?: no

### Who can help?

@stevhliu @Rocketknight1 

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

I am trying to install the packages needed for creating a PR to test my changes. Running `pip install -e ".[dev]"` from this [documentation](https://huggingface.co/docs/transformers/contributing#create-a-pull-request) results in the following error:

```markdown
ERROR: Cannot install transformers and transformers[dev]==4.50.0.dev0 because these package versions have conflicting dependencies.

The conflict is caused by:
    transformers[dev] 4.50.0.dev0 depends on tensorflow<2.16 and >2.9; extra == "dev"
    tensorflow-text 2.8.2 depends on tensorflow<2.9 and >=2.8.0; platform_machine != "arm64" or platform_system != "Darwin"
    transformers[dev] 4.50.0.dev0 depends on tensorflow<2.16 and >2.9; extra == "dev"
    tensorflow-text 2.8.1 depends on tensorflow<2.9 and >=2.8.0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip to attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
```

This happens because of the specification of `tensorflow-text<2.16` here:
https://github.com/huggingface/transformers/blob/c0c5acff077ac7c8fe68a0fdbad24306dbd9d4e3/setup.py#L179

### Expected behavior

`transformers[dev]` requires `tensorflow` above version 2.9, while `tensorflow-text` explicitly restricts TensorFlow to versions below 2.9.

Also, there is no 2.16 version, neither of `tensorflow` or `tensorflow-text`:
https://pypi.org/project/tensorflow/#history
https://pypi.org/project/tensorflow-text/#history

```markdown
INFO: pip is looking at multiple versions of transformers[dev] to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement tensorflow<2.16,>2.9; extra == "dev" (from transformers[dev]) (from versions: 2.16.0rc0, 2.16.1, 2.16.2, 2.17.0rc0, 2.17.0rc1, 2.17.0, 2.17.1, 2.18.0rc0, 2.18.0rc1, 2.18.0rc2, 2.18.0, 2.19.0rc0)
ERROR: No matching distribution found for tensorflow<2.16,>2.9; extra == "dev"
```

What is the correct `tensorflow-text` version?

Comments:
Hi @d-kleine, the version pin was probably put in place because of Keras 3 compatibility issues. Do you know if more recent versions of `tensorflow-text` will still work with Keras 2 as long as we're using something like the LEGACY_KERAS envvar?

I see - no, doesn't look like that: https://keras.io/getting_started/#tensorflow--keras-2-backwards-compatibility

Yeah, tricky - we can get newer versions of Tensorflow itself to work using the `tf-keras` Keras 2 compatibility package, but the pin for `tensorflow-text` is unavoidable, starting from whatever point it no longer supports `tf-keras`.

I just tried to install the dev dependencies on Ubuntu, resulting in the same error:
```markdown
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement tensorflow<=2.15,>2.9; extra == "dev" (from transformers[dev]) (from versions: 2.16.0rc0, 2.16.1, 2.16.2, 2.17.0rc0, 2.17.0rc1, 2.17.0, 2.17.1, 2.18.0rc0, 2.18.0rc1, 2.18.0rc2, 2.18.0, 2.19.0rc0)
```

This would mean you could only use Python 3.10 for development. And even then, I am not sure if the dependency conflict will be solved then.

I would kindly request a CI workflow that checks for dependency issues for (at least):
- different operating systems (Linux, Windows, Mac)
- different Python versions (currently, it only says "Python 3.9+", which seems to be wrong for 3.11 and higher)

@stevhliu `pip install ".[docs]"` also does not work as described in the [contribution guideline](https://huggingface.co/docs/transformers/contributing#create-a-pull-request). There is no `extras["docs"]` in the [setup.py](https://github.com/huggingface/transformers/blob/66f29aaaf55c8fe0c3dbcd24beede2ca4effac56/setup.py) defined.

```markdown
WARNING: transformers 4.50.0.dev0 does not provide the extra 'docs'
```

Good catch, thanks! I'll submit a fix for it :)

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.

I just run 
```shell
conda create -n transformers python=3.10
conda activate transformers
pip install -e '.[dev]'
```

on Mac and this is the output:
```
ERROR: Could not find a version that satisfies the requirement tensorflow-text<2.16; extra == "dev" (from transformers[dev]) (from versions: 2.17.0rc0, 2.17.0, 2.18.0rc0, 2.18.0, 2.18.1, 2.19.0rc0, 2.19.0)
ERROR: No matching distribution found for tensorflow-text<2.16; extra == "dev"
```

Tried python 3.11 as well but didn't work.

@HRezaei I can't reopen this issue, you probably have to open a separate issue if the problem still exists