Skip to content
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

Improve error message when constraints conflict with requirements. #1200

Closed
jsirois opened this issue Jan 23, 2021 · 2 comments
Closed

Improve error message when constraints conflict with requirements. #1200

jsirois opened this issue Jan 23, 2021 · 2 comments

Comments

@jsirois
Copy link
Member

jsirois commented Jan 23, 2021

Right now straight pip gives:

$ pip download pex==2.1.28 --constraint <(echo pex==2.1.27)
ERROR: Could not find a version that satisfies the requirement pex==2.1.28
ERROR: No matching distribution found for pex==2.1.28

There is no extra useful information to gather even in the verbose logs.

Pex could use the full requirements / constraints parsing it is now capable of and either fail fast or else hold information in reserve anticipating Pip failing. Pairs of requirement / constraint could be compared to make sure they were compatible. This would require something like https://pypi.org/project/python-ranges/ but that lib is python 3.6+.

@jsirois
Copy link
Member Author

jsirois commented May 30, 2021

Upgrading vendored Pip will fix this: pypa/pip#9300; so this is just blocked on dropping Python 2 support in Pex.

@jsirois jsirois self-assigned this Sep 15, 2024
@jsirois
Copy link
Member Author

jsirois commented Sep 15, 2024

I'm going to close this as fixed since you can now use --pip-version 1 to select a newer Pip with support for these better error messages. This does not help Python>=2.7,<3.8, but for all other cases:

:; cat constraints.txt
pex==2.1.27

:; pex --python python3.8 pex==2.1.28 --constraint constraints.txt --pip-version latest
pid 518077 -> /home/jsirois/.cache/pex/venvs/0/878245defe5cf7850888db6ca8ac0dfd371cb319/05ac1c1e24762083e2c9af13d44377083b7e8668/bin/python -sE /home/jsirois/.cache/pex/venvs/0/878245defe5cf7850888db6ca8ac0dfd371cb319/05ac1c1e24762083e2c9af13d44377083b7e8668/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --isolated -q --cache-dir /home/jsirois/.cache/pex/pip/0/24.2/pip_cache --log /tmp/pex-pip-log.t44qpfyg/pip.log download --dest /home/jsirois/.cache/pex/downloads/0/resolver_download.wgg7nj6u/home.jsirois..pyenv.versions.3.8.20.bin.python3.8 --constraint constraints.txt pex==2.1.28 --retries 5 --timeout 15 exited with 1 and STDERR:
pip: ERROR: Cannot install pex==2.1.28 because these package versions have conflicting dependencies.
pip: ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
pip:
pip:  The conflict is caused by:
pip:      The user requested pex==2.1.28
pip:      The user requested (constraint) pex==2.1.27
pip:
pip:  To fix this you could try to:
pip:  1. loosen the range of package versions you've specified
pip:  2. remove package versions to allow pip to attempt to solve the dependency conflict

Footnotes

  1. The support for Pip fixes like this was spec'd in Pull in Pip fixes. #1805, implemented in Add support for Pip 22.2.2. #1893 and released in https:/pex-tool/pex/releases/tag/v2.1.104

@jsirois jsirois closed this as completed Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant