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

Confusing error message when a constraint is the cause of not finding a version #2065

Open
notatallshaw opened this issue Feb 29, 2024 · 4 comments
Labels
error messages Messaging when something goes wrong

Comments

@notatallshaw
Copy link
Contributor

Environment: Linux Python 3.10.13 uv 0.1.12

Steps to reproduce:

  1. wget https://raw.githubusercontent.com/apache/airflow/constraints-2.3.4/constraints-3.10.txt
  2. echo "apache-airflow==2.3.4" | uv pip compile - --constraint constraints-3.10.txt

Error:

  × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of exceptiongroup==1.0.0rc8 and cattrs==22.1.0 depends on exceptiongroup==1.0.0rc8, we can conclude that
      cattrs==22.1.0 cannot be used.
      And because apache-airflow==2.3.4 depends on cattrs==22.1.0 and you require apache-airflow==2.3.4, we can conclude that the requirements
      are unsatisfiable.

      hint: exceptiongroup was requested with a pre-release marker (e.g., exceptiongroup==1.0.0rc8), but pre-releases weren't enabled (try:
      `--prerelease=allow`)

This is confusing because cattrs==22.1.0 doesn't depend only on exceptiongroup==1.0.0rc8 and further apache-airflow==2.3.4 does not depend only on cattrs==22.1.0, as you will see if you compie apache-airflow==2.3.4 or cattrs==22.1.0 or both of them together.

There is no mention that it is a user constraint which caused this failure, I beleive pip does mention when a top level user requirement or constraint caused the failure.

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Feb 29, 2024
@zanieb
Copy link
Member

zanieb commented Feb 29, 2024

Ah interesting, thanks for the report!

I'm not entirely sure why these constraints are not represented in the resolver (and subsequently the error report).

@potiuk
Copy link

potiuk commented Mar 2, 2024

Interesting is that while the message is confusing, the hint is correct in this case - adding --prerelease allow fixes the problem and gives the information why uv concludes that it's cattrs.

  • root cause is that airflow constraints for 2.3.4 contain exceptiongroup==1.0.0rc8 (the constraints were generated when there was no 1.0.0 and >= 1.0.0rc8 is coming from pytest actually, not cattrs)

When you run the pip compile above with --prerelease allow - it will produce the right output and part of it is

exceptiongroup==1.0.0rc8
    # via cattrs
  • apparently uv thinks that it's cattrs that caused exceptiongroup problem, but in this case it's the constraint file that contributed the prerelese version.

@notatallshaw
Copy link
Contributor Author

Don't focus on the prerelease part of the error, I've reported that separately and it's already fixed: #2063

After the next release of uv I'll see if I can come up with another example.

@notatallshaw
Copy link
Contributor Author

notatallshaw commented Mar 4, 2024

Okay, now there's a release with the other fix my steps to reproduce don't work. Here are a new set of steps to reproduce:

Environment: Linux Python 3.10.13 uv 0.1.14

  1. wget https://raw.githubusercontent.com/apache/airflow/constraints-2.3.4/constraints-3.10.txt
  2. Edit constraints-3.10.txt and replace pendulum==2.1.2 with pendulum==1.0.0
  3. echo "apache-airflow==2.3.4" | uv pip compile - --constraint constraints-3.10.txt

You get the error:

$ echo "apache-airflow==2.3.4" | uv pip compile - --constraint constraints-3.10.txt
  × No solution found when resolving dependencies:
  ╰─▶ Because apache-airflow==2.3.4 depends on pendulum>=2.0 and apache-airflow==2.3.4 depends on pendulum==1.0.0, we can conclude that apache-airflow==2.3.4 cannot be used.
      And because you require apache-airflow==2.3.4, we can conclude that the requirements are unsatisfiable.

The confusing part is apache-airflow==2.3.4 depends on pendulum==1.0.0 without mentioning that pendulum==1.0.0 comes from the constraints. It would be more confusing if pendulum was a more distant transitive dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

No branches or pull requests

4 participants