-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' with setuptools 71.x #4501
Comments
Update: After opening this issue, I found that the closed issue #4483 describes the same problem. I have to say though that the answer "this is intentionally by design" in #4483 does not satisfy me at all. How can you use another package that you are neither vendorizing nor specifying as a dependency, and then let your users figure out that they have to install a certain minimum version of that package? In a package like setuptools that everybody has to use? So you now want a million package owners that use other tools with a dependency on "packaging" to make sure that "packaging" has the right minimum level? Does "setuptools" document that minimum level? I checked which other packages in my project use which "packaging" version, and here is the result. This is on Python 3.12 with latest versions of all tools installed, and you see that there are plenty of tools that require "packaging" versions below 22.0, so unless a user happens to use (a version of) a tool that requires the right minimum version, they will run into this issue:
|
Please feel free to rephrase your question in light of the context in the duplicate issue (if it's still relevant in that context). |
Set packaging minimum version to 22.0 to avoid the following error with setuptools 71.x: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Likelyhood of encoutering this error increased since commit e4239bd which bumped minimum version of setuptools from 65.5.1 to 70.0.0 More information: - pypa/setuptools#4483 - pypa/setuptools#4501 Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Set packaging minimum version to 22.0 to avoid the following error with setuptools 71.x: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Likelihood of encountering this error increased since commit e4239bd which bumped minimum version of setuptools from 65.5.1 to 70.0.0 More information: - pypa/setuptools#4483 - pypa/setuptools#4501 Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Set packaging minimum version to 22.0 to avoid the following error with setuptools 71.x: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Likelihood of encountering this error increased since commit e4239bd which bumped minimum version of setuptools from 65.5.1 to 70.0.0 More information: - pypa/setuptools#4483 - pypa/setuptools#4501 Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Fix `TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'` when running `pip install --no-deps -e .`, xref pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
Fixes "TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'" See e.g.: pypa/setuptools#4483 pypa/setuptools#4501
setuptools version
71.0.4
Python version
3.12
OS
macOS
Additional environment information
This is only happening since setuptools 71.0.0.
Description
I tried installing my setup.py based project (https://github.com/zhmcclient/zhmccli) from the checked-out repo clone and setuptools failed as follows:
I took a closer look and found:
The reason I had "packaging" 21.3 installed is because some tools used in the development environment for the project (installed with
make develop
) used it. Thedev-requirements.txt
file of the project meanwhile specifies packaging>=23.2, but the virtual env was still from an earlier state of the project.The problem is that "setuptools" seems to have a soft dependency on "packaging": It does not require it to be installed, but when it is installed it is used, e.g in its
_core_metadata.py
file. So "setuptools" ended up not specifying it in its package dependencies, but when it is installed, it still needs a certain minimum version, which is not ensured to be present because the package is not specified in the dependencies.That puts the burden on the users to make sure that "packaging" when needed by other tools, has the required minimum version needed by "setuptools". Not a good situation.
Expected behavior
When "setuptools" uses "packaging" and does not specify it as a dependency, it should to make sure that it works with all versions of "packaging" that can be installed on the given Python version.
There are of course several alternatives to using "packaging" without specifying it as a dependency (vendoring it, specifying it as a dependency, not using it).
How to Reproduce
python -m pip install --upgrade --upgrade-strategy eager -e .
This works fine.
After this, "setuptools" is still at 70.0.0 and "packaging" is not installed.
This shows that "setuptools" 70.0.0 works without "packaging".
pip install setuptools==71.0.4
After this, "packaging" is still not installed because "setuptools" does not specify it as a dependency.
python -m pip install --upgrade --upgrade-strategy eager -e .
This works fine and shows that "setuptools" 71.0.4 works without "packaging".
pip install packaging==21.3
After this, "packaging" is at 21.3 and "setuptools" is still at 71.0.4.
python -m pip install --upgrade --upgrade-strategy eager -e .
This fails as shown above, since "packaging" is below the version needed by "setuptools".
pip install packaging==22.0
python -m pip install --upgrade --upgrade-strategy eager -e .
This works fine again, since "packaging" is now at the version needed by "setuptools".
Output
The output is long, and the relevant output from the failure is shown in the description above.
The text was updated successfully, but these errors were encountered: