-
-
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 |
There is an incompatibility between packaging version from CentOS and setuptools from pip. Which causes a failure running the tests: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' See also pypa/setuptools#4483 Fix this by using a the current packaging version instead of the CentOS packaged one. Signed-off-by: Jean-Louis Dupond <[email protected]>
There is an incompatibility between packaging version from CentOS and setuptools from pip. Which causes a failure running the tests: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' See also pypa/setuptools#4483 Fix this by using a the current packaging version instead of the CentOS packaged one. Signed-off-by: Jean-Louis Dupond <[email protected]>
There is an incompatibility between packaging version from CentOS and setuptools from pip. Which causes a failure running the tests: TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero' See also pypa/setuptools#4483 Fix this by using a the current packaging version instead of the CentOS packaged one. Signed-off-by: Jean-Louis Dupond <[email protected]>
I was constantly getting the same error on a previously working Jupiter Notebook with python 3.10 no matter what dependencies I was trying to change. |
(aside) Now that I write (4), I realize that When I say it's by design, I mean I'm unaware of any other design that meets Setuptools stated goal to be able to follow standard dependency practices and declare dependencies on any packages it requires. This goal is something I've been working on for years. I recognize and sympathize with the downstream effects of this transition, but I have to say, I'm really appreciating the progress this project has made toward having a simpler and more manageable vendoring strategy and possibly eventually removing the need for vendoring altogether. I'm open to suggestions, but "just bundle everything all the time" is a regression in the design and a non-starter. What is your suggestion? |
Work around upstream breakage due to pypa/setuptools#4483
* 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]>
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: