Hải Bình
Hải Bình

Reputation: 91

Could not resolve dependencies while installing libraries with cabal

Every effort of me trying to install a library using cabal on Window 10 resulted in the same error:

cabal install gtk
cabal.exe: Could not resolve dependencies:
[__0] trying: parconc-examples-0.4.8 (user goal)
[__1] next goal: base (dependency of parconc-examples)
[__1] rejecting: base-4.15.0.0/installed-4.15.0.0 (conflict: parconc-examples
=> base>=4.5 && <4.14)
[__1] skipping: base-4.15.0.0, base-4.14.2.0, base-4.14.1.0, base-4.14.0.0
(has the same characteristics that caused the previous version to fail:
excluded by constraint '>=4.5 && <4.14' from 'parconc-examples')
[__1] rejecting: base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: base, parconc-examples)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, parconc-examples

It worked perfectly fine on Linux, but I have not found how to resolve the problem on Windows.

Upvotes: 7

Views: 5402

Answers (1)

danidiaz
danidiaz

Reputation: 27771

Your version of the base library is 4.15.0.0. base is special in the sense that its version is tied to your GHC version, which seems to be GHC 9.0.1.

So, unlike with other libraries, cabal can't simply install a previous version of base when it's required by the build-depends: of some package.

parconc-examples has the following constraint on base: >=4.5 && <4.14. So version 4.15 is not accepted ("constraint from non-upgradeable package requires installed instance").

One thing you could try is to pass the extra option --allow-newer=base, like cabal install --allow-newer=base gtk. This will relax the restriction.

But it isn't a panacea: parconc-examples (or other package required by gtk) might actually fail to build with base == 4.15, because it might use some aspect of base == 4.14 that has changed in a non-backwards compatible way. Preventing such build failures is the purpose of bounds, after all.

Upvotes: 10

Related Questions