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

[pip-compile] Upgrading a dependency with -P that has extras fails with backtracking resolver #1806

Closed
nwalsh1995 opened this issue Feb 1, 2023 · 6 comments
Labels
bug Something is not working

Comments

@nwalsh1995
Copy link

nwalsh1995 commented Feb 1, 2023

Environment Versions

  1. Python version: 3.7.5
  2. pip version: 23.0
  3. pip-tools version: 6.12.2

Steps to replicate

  1. Create requirements.in file.
# requirements.in
googleapis-common-protos[grpc]==1.56.4
google-api-core[grpc]==1.32.0
  1. Attempt upgrading googleapis-common-protos[grpc] with -P and the backtracking resolver
pip-compile -v --resolver backtracking -P googleapis-common-protos\[grpc\] requirements.in

Expected result

pip-compile upgrades googleapis-common-protos\[grpc\] and extra packages.

Actual result

pip._internal.exceptions.InstallationError: Constraints cannot have extras

Note: without --resolver backtracking the call succeeds after multiple rounds.

pip-compile -v -P googleapis-common-protos\[grpc\] requirements.in

Edit: the command also doesn't work with --strip-extras:

$ pip-compile -v --strip-extras --resolver=backtracking -P googleapis-common-protos\[grpc\] requirements.in

pip._internal.exceptions.InstallationError: Constraints cannot have extras
@pawelad
Copy link

pawelad commented Feb 2, 2023

You should be able to bypass that problem by passing extra --strip-extras option to pip-tools.

@nwalsh1995
Copy link
Author

You should be able to bypass that problem by passing extra --strip-extras option to pip-tools.

Hi @pawelad, it doesn't work with --strip-extras either:

$ pip-compile -v --strip-extras --resolver=backtracking -P googleapis-common-protos\[grpc\] requirements.in

pip._internal.exceptions.InstallationError: Constraints cannot have extras

@nwalsh1995
Copy link
Author

FYI the patch from @deivid-rodriguez here fixes this issue. Will see if Deivid wants to make the PR.

@deivid-rodriguez
Copy link
Contributor

Happy to provide a PR but as I said over at the dependabot ticket, I did not manage to write a test for it.

@nwalsh1995
Copy link
Author

This issue is fixed in #1808 🎉

@atugushev atugushev added the bug Something is not working label Feb 21, 2023
@atugushev
Copy link
Member

Completed via #1808.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

No branches or pull requests

4 participants