-
-
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' #4483
Comments
Issue is visible when you use packaging<22.0 |
Could reproduce the same issue. Fixed by downgrading to 70.x |
Also it can be fixed by update packaging to 22.0 or higher |
This behavior is by design. Similar to the issue reported in #4478, the new Setuptools 71 will prefer installed dependencies over the vendored ones. You'll want to either uninstall the older (incompatible) dependencies from the environment or install these dependencies. |
Just to confirm, we're seeing this happen in this environment: python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel twine check-wheel-contents Is that correct? It sounds like you're saying the issue is old dependencies existing in the environment, but we should have the most current packages here. |
Thanks @jaraco this was helpful. In my project where I was having the issue because on older version of It's a bit annoying that the behaviour of setuptools changed which messed up my tests (which gets the latest version of setuptools when setting up) but that is very much my fault and not your teams. Again, thanks for your comment as it helped my to understand the issue better and what the cause was. For anyone who has a situation like me where my tests just started failing I'd check to make sure your dependancies and the dependancies of setuptools are compatible. |
Thanks for posting your solution. I'm trying to reason through how we're running into the same issue. We're not specifying |
This is now necessary since `setuptools >= 71` started preferring externally present stdlib deps over the vendored ones. Refs: * pypa/setuptools#4457 * pypa/setuptools#4483 * pypa/setuptools#2825
Yes, probably.
Agreed, it is a bit of a sharp corner, and we made the major release as a signal of this shift in expectations. The issue is that while you're holding it correctly and
I think I may have been too cautious about this advice. We specifically want to avoid packages themselves making this declaration in |
@jaraco Thanks for taking the time to respond. This advice is super useful:
The issue that we wound up running into is that older versions of our package actually take a runtime dependency on |
* Upgrade astlib for Python>-3.12. * Move test matrix to newer python versions. * Restrict numpy version on older Python versions * Work around upstream breakage due to pypa/setuptools#4483 --------- Co-authored-by: Benjamin Hugo <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
### Details: - `packaging` is a dependency of `setuptools`. When installed with version lower than 22.0 it results in `TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'` when building wheel. `setuptools` claims it's an expected behavior, does not enforce that constraint and recommends to add the constraint ourselves. More information: pypa/setuptools#4483 - `ImportError: cannot import name 'splat' from 'jaraco.functools'` has been fixed in `setuptools==75.4.0`. More information: pypa/setuptools@8d518af - `Failed to detect ABI Tag via setuptools.command.bdist_wheel` - the functionality has been added in `setuptools==70.1.0`, that's where the new lower bound comes from. More context: https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/wheel/CMakeLists.txt#L15 ### Tickets: - CVS-157981 --------- Signed-off-by: p-wysocki <[email protected]>
### Details: - `packaging` is a dependency of `setuptools`. When installed with version lower than 22.0 it results in `TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'` when building wheel. `setuptools` claims it's an expected behavior, does not enforce that constraint and recommends to add the constraint ourselves. More information: pypa/setuptools#4483 - `ImportError: cannot import name 'splat' from 'jaraco.functools'` has been fixed in `setuptools==75.4.0`. More information: pypa/setuptools@8d518af - `Failed to detect ABI Tag via setuptools.command.bdist_wheel` - the functionality has been added in `setuptools==70.1.0`, that's where the new lower bound comes from. More context: https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/wheel/CMakeLists.txt#L15 ### Tickets: - CVS-157981 --------- Signed-off-by: p-wysocki <[email protected]>
### Details: - `packaging` is a dependency of `setuptools`. When installed with version lower than 22.0 it results in `TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'` when building wheel. `setuptools` claims it's an expected behavior, does not enforce that constraint and recommends to add the constraint ourselves. More information: pypa/setuptools#4483 - `ImportError: cannot import name 'splat' from 'jaraco.functools'` has been fixed in `setuptools==75.4.0`. More information: pypa/setuptools@8d518af - `Failed to detect ABI Tag via setuptools.command.bdist_wheel` - the functionality has been added in `setuptools==70.1.0`, that's where the new lower bound comes from. More context: https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/wheel/CMakeLists.txt#L15 ### Tickets: - CVS-157981 --------- Signed-off-by: p-wysocki <[email protected]>
py39 jobs (on ubuntu-focal) started to fail due to recent virtualenv release (20.26.4) on Yoga (which bundles setuptools), because we have 'packaging==21.3' in this branch that is not compatible with newer setuptools [1]. setuptools is bundled in virtualenv, so it has to be capped via the virtualenv package. tox also needed to be capped (<4) as gate uses tox 3.28.0, but with capping virtualenv we pull in latest tox as well, which would cause other errors. [1] pypa/setuptools#4483 Change-Id: Ibbfef10e65d4acea6dd4e9f8a4fb3a4bcc877549
Under as-yet-unidentified conditions, we can end up with a version of packaging that is too old for the version of latest version of setuptools. This is a known issue and expected behavior and per [1] $subject is the preferred resolution. [1] pypa/setuptools#4483 (comment) Change-Id: I9232f3fae1598297e83c4ea37339896f7dcbd44f Signed-off-by: Stephen Finucane <[email protected]>
* Update devstack from branch 'master' to 320c2bf42ae41d751c72d80a6c85b26f3f6951bd - Install setuptools 'core' extra Under as-yet-unidentified conditions, we can end up with a version of packaging that is too old for the version of latest version of setuptools. This is a known issue and expected behavior and per [1] $subject is the preferred resolution. [1] pypa/setuptools#4483 (comment) Change-Id: I9232f3fae1598297e83c4ea37339896f7dcbd44f Signed-off-by: Stephen Finucane <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
There seems to be a well known error in setuptools 71.x that prevents installation of cpp-coveralls on Travis now: File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 285, in _distribution_fullname canonicalize_version(version, strip_trailing_zero=False), TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' Fall back to the default version that is used in Ubuntu Jammy (59.6.0) since later versions also lead to the same error. Link: pypa/setuptools#4483 Signed-off-by: Stefan Berger <[email protected]>
Under as-yet-unidentified conditions, we can end up with a version of packaging that is too old for the version of latest version of setuptools. This is a known issue and expected behavior and per [1] $subject is the preferred resolution. [1] pypa/setuptools#4483 (comment) Change-Id: I9232f3fae1598297e83c4ea37339896f7dcbd44f Signed-off-by: Stephen Finucane <[email protected]> (cherry picked from commit 320c2bf)
… 12 (#776) Resolve BE-2112 This seems to be a breaking change made to the setuptools library and the maintainer does not seem likely to fix it. pypa/setuptools#4483 It feels bad to be pinning an old version, but for now that seems to be the best way of mitigating this problem.
This is a combination of four patch to fix the gate: 1. Use compatible version of heat-tempest-plugin heat-tempest-plugin dropped py38 support, hence it cannot be installed from recent master, so we need to override the checkout to the version that still supports py38 and compatible to the actual branch. This is needed both for the grenade job and the functional job, because these are using the heat-tempest-plugin. 2. Try archive path to download Fedora image This is a temporal workaround to allow downloading Fedora 37 image which was moved to the archive path. 3. Remove reference to devstack-gate devstack-gate was deprecated in xena and is being retired now[1]. 4. [stable-only] Cap setuptools <71.0.0 py39 jobs (on ubuntu-focal) started to fail due to recent virtualenv release (20.26.4) on Yoga (which bundles setuptools), because we have 'packaging==21.3' in this branch that is not compatible with newer setuptools [2]. setuptools is bundled in virtualenv, so it has to be capped via the virtualenv package. tox also needed to be capped (<4) as gate uses tox 3.28.0, but with capping virtualenv we pull in latest tox as well, which would cause other errors. [1] https://review.opendev.org/c/openstack/governance/+/919629 [2] pypa/setuptools#4483 Changes: .zuul.yaml NOTE(elod.illes): change in .zuul.yaml is to adapt the patch to the current branch ('<series>-last' needs to be used). Change-Id: I9b1702749976a2cea42a24130e5fec2931b75ce1 (cherry picked from commit a806b40) (cherry picked from commit ae62258) (cherry picked from commit 4fd9953) (cherry picked from commit 81a8b93) (cherry picked from commit 665ccfc) (cherry picked from commit c18b344)
This is a combination of five patch to fix the gate: 1. Use compatible version of heat-tempest-plugin heat-tempest-plugin dropped py38 support, hence it cannot be installed from recent master, so we need to override the checkout to the version that still supports py38 and compatible to the actual branch. This is needed both for the grenade job and the functional job, because these are using the heat-tempest-plugin. 2. Try archive path to download Fedora image This is a temporal workaround to allow downloading Fedora 37 image which was moved to the archive path. 3. Remove reference to devstack-gate devstack-gate was deprecated in xena and is being retired now[1]. 4. [stable-only] Cap setuptools <71.0.0 py39 jobs (on ubuntu-focal) started to fail due to recent virtualenv release (20.26.4) on Yoga (which bundles setuptools), because we have 'packaging==21.3' in this branch that is not compatible with newer setuptools [2]. setuptools is bundled in virtualenv, so it has to be capped via the virtualenv package. tox also needed to be capped (<4) as gate uses tox 3.28.0, but with capping virtualenv we pull in latest tox as well, which would cause other errors. 5. Set functional jobs as non-voting heat-functional jobs try to install python-zaqarclient (via zaqar project) from master branch, but on master the client dropped py38 support, hence the jobs fail. This patch sets it non-voting as a quick workaround until a final fix arrives. [1] https://review.opendev.org/c/openstack/governance/+/919629 [2] pypa/setuptools#4483 Changes: .zuul.yaml NOTE(elod.illes): change in .zuul.yaml is to adapt the patch to the current branch ('<series>-last' needs to be used). Change-Id: I9b1702749976a2cea42a24130e5fec2931b75ce1 (cherry picked from commit a806b40) (cherry picked from commit ae62258) (cherry picked from commit 4fd9953) (cherry picked from commit 81a8b93) (cherry picked from commit 665ccfc) (cherry picked from commit c18b344) (cherry picked from commit dcf7403)
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
setuptools>=71.0.0
Python version
Python 3.12
OS
Ubuntu
Additional environment information
I found this bug when running the test for the project in GitHub actions
Description
When I install the requirements in my Python package project (
pip-sync requirements-dev.txt
) I get an error within setuptools which says:This error was caused by using setuptools >= 71.0.0
Not to speculate but it looks like the issue was introduced by this commit in setuptools: 00384a5
And this commit is including new changes from the packaging project and its this commit here where we can see the issue:
pypa/packaging@cc938f9
https://github.com/pypa/packaging/blame/4493dfcd95a893f676a7aa4bd17c547bea676371/src/packaging/utils.py#L58
Expected behavior
I would expect
pip-sync requirements-dev.txt
to run successfullyHow to Reproduce
Clone https://github.com/tim-s-ccs/example-python-package.git
Make sure you are using Python 3.12 and you have pip-tools installed (
pip install --upgrade pip wheel pip-tools
)Make sure you are using the correct version of setuptools
pip install --upgrade setuptools==71.0.0
Run
pip-compile requirements-dev.in
Output
The text was updated successfully, but these errors were encountered: