Unused constraints result in "no available version" #915

bos opened this Issue May 24, 2012 · 4 comments


None yet
1 participant

bos commented May 24, 2012

(Imported from Trac #925, reported by @snoyberg on 2012-03-07)

When testing out my recently released cabal nirvana[1], Greg Weber pointed out than when building a package that does not use all of the constraints in the Nirvana file, you get a message such as:

cabal: There is no available version of authenticate that satisfies ==

I confirmed that this happens with command-line constraints as well. A simple test case is to go into a non-Yesod project and run:

cabal install --constraint "yesod >= 0.10"

Unfortunately, this prevents nirvana from being of any use at all, which was our best shot at avoiding dependency hell.

[1] http://hackage.haskell.org/package/cabal-nirvana


bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-03-07)

I've changed your bug into an enhancement request. What you're describing is intended behaviour. A constraint passed on the command line acts the same as a constraint put in the build-depends of a package, i.e., it not only restricts the range of versions, but also causes the package to actually be installed.

The closest to what you want that currently exists is --preference, and it should actually be sufficient in most cases. A --preference constraint does not prevent excluded versions from selected at all, but it will first try all preferred versions.

I appreciate the attempt you make with cabal-nirvana, but I don't like that it works by actually changing the downloaded files. Cabal already supports a global preferences file that's downloaded from Hackage. It should probably support local files with preferences, too. That would be relatively easy to change.

So there are two possible enhancements in this issue:

  • introduce a way to easily specify a large number of local preferences,
  • next to constraints introduced by --preference and --constraint
The mail


as well as the surrounding thread are also somewhat related.


bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-03-07)

Also see #380.


bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-03-08)

I may have misunderstood the intended meaning of the --constraint flag. Investigating.


bos commented May 24, 2012

(Imported comment by @kosmikus on 2012-03-09)

Ok. I think that I have indeed mistakenly assumed that the old behaviour of --constraint was intended when it was not. Sorry for that.

In the current development repository (and in the upcoming cabal-install-0.14), constraints behave as was the assumption in this bug report originally. Saying --constraint=... on the command line does not introduce a target, it merely constrains the package.

So I'll restore the original title and consider this bug as fixed.

bos closed this May 24, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment