Transitive dependencies in setup_requires should be able to override system versions
See original GitHub issueThis is basically the same issue as https://github.com/pypa/setuptools/issues/223 but for transitive dependencies.
Issue:
When a package my_pkg
depends (with install_requires
) on my_transitive_dep
with a version that conflict with the currently installed version of my_transitive_dep
, adding my_pkg
as a setup_requires
to the setup.py
of a project fails to initialise the Distribution object and raises pkg_resources.VersionConflict
.
Expected behaviour:
The proper version of my_transitive_dep
is installed in .eggs
and the currently installed version of my_transitive_dep
is ignored.
Minimal steps to reproduce the issue:
(in a virtualenv, python 2.7.13)
setuptools-versionconflict $ pip install 'setuptools<30'
Collecting setuptools<30
Using cached https://pypi.apple.com/packages/06/4b/86a670fd21f7849adb092e40883c48dcd0d66b8a878fc8d63b7f0ea04213/setuptools-29.0.1-py2.py3-none-any.whl
Installing collected packages: setuptools
Successfully installed setuptools-29.0.1
setuptools-versionconflict $ cat setup.py
from setuptools import setup
setup(
name='my-test',
setup_requires=['flake8'] # flake8 has `setuptools>=30` in its `install_requires`
)
setuptools-versionconflict $ python setup.py clean
zip_safe flag not set; analyzing archive contents...
Installed /private/var/folders/cg/b7r4x8m15p59z4glfsy6s_640000gn/T/easy_install-q7dnDn/flake8-3.4.1/.eggs/pytest_runner-2.11.1-py2.7.egg
warning: no previously-included files matching '*.pyc' found anywhere in distribution
no previously-included directories found matching 'docs/build/'
zip_safe flag not set; analyzing archive contents...
Installed /Users/rchossart/tmp/setuptools-versionconflict/.eggs/flake8-3.4.1-py2.7.egg
Traceback (most recent call last):
File "setup.py", line 5, in <module>
setup_requires=['flake8']
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1115, in best_match
dist = working_set.find(req)
File "/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 719, in find
raise VersionConflict(dist, req)
pkg_resources.VersionConflict: (setuptools 29.0.1 (/Users/rchossart/tmp/setuptools-versionconflict/.venv/lib/python2.7/site-packages), Requirement.parse('setuptools>=30'))
EDIT: clarified the problem definition.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Overriding Dependency Versions and Using Version Ranges ...
Get step-by-step guidance on managing dependencies in Maven: declare dependencies, overriding dependency versions, and using version ranges.
Read more >Upgrading versions of transitive dependencies
Dependency constraints allow you to define the version or the version range of both dependencies declared in the build script and transitive dependencies....
Read more >Overriding Dependency Versions with Spring Boot
This article explains some of the dependency management tricks that can be used to create libraries and apps that depend on newer versions...
Read more >Overriding transitive version dependency in maven
Typically you need to define a transitive dependency by tagging to a specific version. lets say: your wished dependency needs a newer ...
Read more >Dependency Management — Dataverse.org
Maven modules should not be confused with the Java Platform Module System (JPMS) ... Maven can manage versions of transitive dependencies in four...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sitaktif: check the torture tests in #1129, I believe both use cases are handled:
🙏 ❤️