Broken metadata in transformers 4.57.0 causing Poetry <empty> version parse error
Author: ashisjena
Pull request: no
Labels: name: bug

### System Info

**Description**
After upgrading to transformers 4.57.0, Poetry fails to generate the lock file or install dependencies, showing:

`Could not parse version constraint: <empty>`

**Steps to reproduce**

1. Create a new Poetry project:

```
poetry new test-transformers
cd test-transformers
poetry add transformers==4.57.0
```
2. Run: `poetry install`
3. Error occurs.

**Observed behavior**

- Poetry lock file contains: `optax (<empty>)`
- Installation fails with version parsing error.

**Expected behavior**

- Lock file should correctly parse extras.
- Installation should succeed like previous version (e.g., 4.56.0).

**Workaround**
```
Pin transformers to 4.56.0:

poetry add transformers==4.56.0
```


**Environment**

OS: Windows 11

Python: 3.12.0

Poetry: 2.2.1

**Additional context**
It seems that the metadata for extra optax in 4.57.0 is empty or invalid. This breaks PEP 508 compliance and causes Poetry to fail parsing the version constraints.

### Who can help?

_No response_

### 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

1. Create a new Poetry project:

```
poetry new test-transformers
cd test-transformers
poetry add transformers==4.57.0
```
2. Run: `poetry install`
3. Error occurs.

**Observed behavior**

- Poetry lock file contains: `optax (<empty>)`
- Installation fails with version parsing error.

### Expected behavior

**Expected behavior**

- Lock file should correctly parse extras.
- Installation should succeed like previous version (e.g., 4.56.0).

**Workaround**
```
Pin transformers to 4.56.0:

poetry add transformers==4.56.0
```

**Workaround**
```
Pin transformers to 4.56.0:

poetry add transformers==4.56.0
```


**Environment**

OS: Windows 11

Python: 3.12.0

Poetry: 2.2.1

**Additional context**
It seems that the metadata for extra optax in 4.57.0 is empty or invalid. This breaks PEP 508 compliance and causes Poetry to fail parsing the version constraints.

Comments:
Hi  @ashisjena 👋, I’d like to work on this issue. Could you please assign it to me?  


@ashisjena  The issue is fixed in PR #41334 🚀  
Added a proper version constraint for `optax` extra, so Poetry now parses dependencies correctly.  


It seems like `optax` is intentionally being removed.  https://github.com/huggingface/transformers/pull/41030

However, that PR was not completed cherry picked into v4.57.0.  Only [this line](https://github.com/huggingface/transformers/pull/41030/files#diff-2cdd785cddad81bcdfe56b6c1a7952ad7d9eb64098ba4a7ecc80de38d761d955L44)  was in 4.57.0.  The [removal from the setup.py](https://github.com/huggingface/transformers/pull/41030/files#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7L135) was missed.  

The `optax` is still in `setup.py` on v4.57.0.  https://github.com/huggingface/transformers/blob/v4.57.0/setup.py#L141

Thanks for the details @jimmy-sunco 🙌  

You are right — `optax` was meant to be removed in #41030, but the cherry-pick into v4.57.0 was incomplete, leaving a leftover entry in `setup.py`. That caused Poetry to parse `optax (<empty>)` and break with #41331.

This PR removes the stale `optax` extra and aligns the packaging with #41030:
👉 PR: #41334  

Once merged, this should fully resolve the `<empty>` version parse error in v4.57.0. ✅  

@ArthurZucker @Cyrilvallez tagging you for visibility.


Yep we'll do a patch for that asap sorry

Same

I am getting the same error when I install sentence-transformers 

`poetry add sentence-transformers`

I am seeing the same issue and found the commit / line: [click](https://github.com/huggingface/transformers/commit/010896e8cdb293ab6b1442011699ac8adc1c0d52#diff-60f61ab7a8d1910d86d9fda2261620314edcae5894d5aaa236b821c7256badd7R141)

Just to be pedantic: poetry does not stumble over optax being there - it stumbles over the version number that got re-introduced in a malformed fashion in that commit. `x.0x` is not valid apparently.

Please fix this an issue with poetry for a more gracefull error handling is also open: https://github.com/python-poetry/poetry/issues/10577.

same issue here

Do we have a timeline on when this can be released? A lot of people must be facing this and spending time debugging.

I would also ask to yank 4.57.0 even if noboy is actively using it it will be bad for the dependency resultion for times to come.

I agree, cancel the release of the library.

In this file: https://github.com/huggingface/transformers/blob/v4.57.0/setup.py#L141
`"optax>=0.08,<=0.1.4",`
The version constraint `0.08` is incorrect and should be `0.0.8`

See version list of optax. https://github.com/google-deepmind/optax/tree/v0.0.8

`0.08` is not a valid version number according to PEP 440, which causes Poetry to parse it as `<empty>`.
See PEP 440: https://peps.python.org/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions

+1 on yanking the version 4.57.0 and fixing this issue. Version 4.57.0 has been up for 11 days and counting and it is breaking the generation of lockfiles worldwide.

<img width="1174" height="188" alt="Image" src="https://github.com/user-attachments/assets/b45e1937-2666-497b-8799-1eedbc04f899" />

Will release a patch today 🤗 We're only a very small team of maintainers, and all extremely busy these past weeks due to the incoming v5, sorry for the inconvenience

> Will release a patch today 🤗 We're only a very small team of maintainers, and all extremely busy these past weeks due to the incoming v5, sorry for the inconvenience

I thinks most of us know your pain. Its just kind of a huge problem. Will you be yanking the old verison also? Otherwise this problem might be a problem even after you patch.

> Will release a patch today 🤗 We're only a very small team of maintainers, and all extremely busy these past weeks due to the incoming v5, sorry for the inconvenience

Great! Thank you. I appreciate the work you and your team does!

Sorry for the passive aggressive tone. My comment was made out of frustration with the ML dependency churn as a whole and the disappointment that even a company like huggingface (which has been a great boon for the stability of the ML world) would leave an issue like this for so long. I look forward to the fix :)

We just yanked it! Hope it will avoid any issue in the future!

Thank you for the fix!