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

Adding new dependency to extra-deps makes version checking go nuts #1735

Closed
bitemyapp opened this issue Feb 4, 2016 · 11 comments
Closed

Adding new dependency to extra-deps makes version checking go nuts #1735

bitemyapp opened this issue Feb 4, 2016 · 11 comments

Comments

@bitemyapp
Copy link
Contributor

Cf. #1734

$ make
stack build
While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:    
      persistent: needed (>=1.1), couldn't resolve its dependencies
      yesod: needed (>=1.2), couldn't resolve its dependencies
      yesod-newsfeed: needed (-any), couldn't resolve its dependencies
      yesod-static: needed (-any), couldn't resolve its dependencies
    needed for package: classy-prelude-yesod-0.12.5

--  Failure when adding dependencies:    
      monad-logger: needed (-any), couldn't resolve its dependencies
      persistent: needed (>=2.1.1.7 && <2.3), couldn't resolve its dependencies
    needed for package: esqueleto-2.4.2

--  Failure when adding dependencies:    
      classy-prelude-yesod: needed (>=0.10.2), couldn't resolve its dependencies
      esqueleto: needed (-any), couldn't resolve its dependencies
      monad-logger: needed (>=0.3.8 && <0.4), couldn't resolve its dependencies
      persistent: needed (>=2.0 && <2.3), couldn't resolve its dependencies
      persistent-postgresql: needed (>=2.1.1 && <2.3), couldn't resolve its dependencies
      persistent-template: needed (>=2.0 && <2.3), couldn't resolve its dependencies
      thoth: needed (-any), couldn't resolve its dependencies
      yesod: needed (>=1.4.1 && <1.5), couldn't resolve its dependencies
      yesod-auth: needed (>=1.4.0 && <1.5), couldn't resolve its dependencies
      yesod-core: needed (>=1.4.17 && <1.5), couldn't resolve its dependencies
      yesod-form: needed (>=1.4.0 && <1.5), couldn't resolve its dependencies
      yesod-static: needed (>=1.4.0.3 && <1.6), couldn't resolve its dependencies
    needed for package: hestia-0.0.0

--  Failure when adding dependencies:    
      fast-logger: needed (>=2.0 && <2.3), 2.4.1 found (latest applicable is 2.2.3)
      monad-control: needed (<1), 1.0.0.5 found (latest applicable is 0.3.3.1)
    needed for package: monad-logger-0.3.8

--  Failure when adding dependencies:    
      monad-logger: needed (>=0.3), couldn't resolve its dependencies
    needed for package: persistent-2.2.4

--  Failure when adding dependencies:    
      monad-logger: needed (>=0.3.4), couldn't resolve its dependencies
      persistent: needed (>=2.2 && <3), couldn't resolve its dependencies
    needed for package: persistent-postgresql-2.2.2

--  Failure when adding dependencies:    
      monad-logger: needed (-any), couldn't resolve its dependencies
      persistent: needed (>=2.2.2 && <3), couldn't resolve its dependencies
    needed for package: persistent-template-2.1.5

--  Failure when adding dependencies:    
      esqueleto: needed (-any), couldn't resolve its dependencies
      monad-logger: needed (-any), couldn't resolve its dependencies
      persistent: needed (-any), couldn't resolve its dependencies
      persistent-postgresql: needed (-any), couldn't resolve its dependencies
      persistent-template: needed (-any), couldn't resolve its dependencies
    needed for package: thoth-0.1.0.0

--  Failure when adding dependencies:    
      monad-logger: needed (-any), couldn't resolve its dependencies
      yesod-auth: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-core: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-form: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-persistent: needed (>=1.4 && <1.5), couldn't resolve its dependencies
    needed for package: yesod-1.4.2

--  Failure when adding dependencies:    
      persistent: needed (>=2.1 && <2.3), couldn't resolve its dependencies
      persistent-template: needed (>=2.1 && <2.2), couldn't resolve its dependencies
      yesod-core: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-form: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-persistent: needed (>=1.4), couldn't resolve its dependencies
    needed for package: yesod-auth-1.4.12

--  Failure when adding dependencies:    
      monad-logger: needed (>=0.3.1 && <0.4), couldn't resolve its dependencies
    needed for package: yesod-core-1.4.19

--  Failure when adding dependencies:    
      persistent: needed (-any), couldn't resolve its dependencies
      yesod-core: needed (>=1.4 && <1.5), couldn't resolve its dependencies
      yesod-persistent: needed (>=1.4 && <1.5), couldn't resolve its dependencies
    needed for package: yesod-form-1.4.6

--  Failure when adding dependencies:    
      yesod-core: needed (>=1.4 && <1.5), couldn't resolve its dependencies
    needed for package: yesod-newsfeed-1.5

--  Failure when adding dependencies:    
      persistent: needed (>=2.1 && <2.3), couldn't resolve its dependencies
      persistent-template: needed (>=2.1 && <2.2), couldn't resolve its dependencies
      yesod-core: needed (>=1.4.0 && <1.5), couldn't resolve its dependencies
    needed for package: yesod-persistent-1.4.0.3

--  Failure when adding dependencies:    
      yesod-core: needed (>=1.4 && <1.5), couldn't resolve its dependencies
    needed for package: yesod-static-1.5.0.3
Makefile:2: recipe for target 'build' failed
make: *** [build] Error 1
@bitemyapp
Copy link
Contributor Author

$ stack --version
Version 1.0.2 x86_64

@mgsloan
Copy link
Contributor

mgsloan commented Feb 4, 2016

Yeah, I agree that this is information overload. What's happening is that monad-logger's dependencies aren't satisfied:

--  Failure when adding dependencies:    
      fast-logger: needed (>=2.0 && <2.3), 2.4.1 found (latest applicable is 2.2.3)
      monad-control: needed (<1), 1.0.0.5 found (latest applicable is 0.3.3.1)
    needed for package: monad-logger-0.3.8

I'm not sure what the best way to make this output more concise is. A few possibilities:

  • Prioritize or specially mark the resolution errors which are likely to be the "root cause". These are the ones where working packages are available, but their versions are wrong.
  • Only show the errors which are suspected to be the root cause.
  • There is an issue with hiding some of this info, though - you might want to know about constraints that come from other packages. Maybe we'd take all the constraints on a given package together, let the user know where they all come from. If their intersection contains an actual package version, suggest that as the "latest applicable".

That said, I'm not looking at the code right now, I'm not sure what the best thing is, but I bet we can do a lot better than the current output!

We might also consider making it more straightforward to use this as guidance. For example, it might tell you to try adding the following to extra-deps:

- fast-logger-2.2.3
- monad-control-0.3.3.1

@mgsloan mgsloan added this to the P2: Should milestone Feb 4, 2016
@bitemyapp
Copy link
Contributor Author

@mgsloan I added that and a lot more dependencies to extra-deps. It didn't work.

- monad-logger-0.3.8
- fast-logger-2.4.1
- persistent-2.2.4
- persistent-template-2.1.5
- yesod-1.4.2
- yesod-core-1.4.19
- yesod-form-1.4.6
- yesod-newsfeed-1.5
- yesod-persistent-1.4.0.3
- yesod-static-1.5.0.3
- classy-prelude-yesod-0.12.5

For example. I specified everything it mentioned in the verbose representation. Didn't work.

I do think it should be narrowed down, prioritized, highlighted. Something. But what you're pointing out as having needed highlighting didn't produce a fix anyway when I acted on it.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 4, 2016

How did it not work?

Note that there is no guarantee that a given extra-dep is feasible atop a snapshot. This is akin to the circumstance where cabal cannot find a build plan. Perhaps pick a different version of monad-logger, or a different snapshot?

@bitemyapp
Copy link
Contributor Author

This is akin to the circumstance where cabal cannot find a build plan.

Except I could debug what it told me and fix the version bounds in those circumstances. FSR, I cannot figure out what exactly the conflicts are from what Stack tells me.

Perhaps pick a different version of monad-logger

Well no, that would defeat the purpose.

or a different snapshot?

This was with LTS-5.1. Should I try a nightly?

@mgsloan
Copy link
Contributor

mgsloan commented Feb 4, 2016

Except I could debug what it told me and fix the version bounds in those circumstances

In my experience, cabal-install's dependency resolution errors were far less scrutable than these, but hey, we each have our own subjective experience of these things.

This was with LTS-5.1. Should I try a nightly?

Sure, worth a shot.

How does it not work? What output is it giving you? I am confused why you are saying it doesn't work, but with no output.

@luigy
Copy link
Contributor

luigy commented Feb 4, 2016

Well no, that would defeat the purpose.

is there a typo? did you mean to add monad-logger-0.3.18 from the link instead of version 0.3.8
if so that should require less things in your extra-deps

if it is actually 0.3.8 then the deps should be what mgsloan mentioned

- monad-logger-0.3.8
- fast-logger-2.2.3
- monad-control-0.3.3.1

also I believe the packages in "needed for package" are available from the snapshot so they can be removed from extra-deps. The "latest applicable" packages are the ones that have to be tinkered

@bitemyapp
Copy link
Contributor Author

@luigy bloody hell that was it. Thank you both @luigy and @mgsloan!

@mgsloan
Copy link
Contributor

mgsloan commented Feb 4, 2016

Welcome! I agree that extra-deps not checking typos royally sucks #1521 . I've also opened #1739 to track making the errors more concise and helpful.

@harendra-kumar
Copy link
Collaborator

Fixing typos in version numbers (where the typed version is valid) may not be possible because we don't know whether it is a typo or the user really wants that particular version. We can only tell if a working plan is possible or not with the given combination of versions.

I think we should recommend the use of stack solver for figuring out extra-deps instead of specifying extra-deps manually. Solver will tell you if the given config works or not and can also suggest changes. That way, it can also be viewed as a config checker. In cases where the user really wants a specific version of an extra-dep then he should specify only that one manually and use solver to figure out the rest.

There is also a possiblity to use solver automatically at the build time (or suggest solver as the next step) to suggest changes when the build fails - see #1693 .

@bitemyapp can you check if stack solver could have helped you in this case? Preferably using a version after #1674 got merged.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 5, 2016

I agree that there should be some message telling the user to either use stack solver or choose extra-deps to satisfy the build plan.

Fixing typos in version numbers (where the typed version is valid)

True! The issue here is typos in the package names. I've opened up #1748 to track going a step further than just detecting non-existent extra-deps, but also suggesting a package name that the user intended.

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

4 participants