Cabal trouble resolving dependencies - haskell

I'm tring to install the package cabal-debian globally using cabal v2-install cabal-debian and get this error message:
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: base-4.12.0.0/installed-4.1... (user goal)
[__1] trying: binary-0.8.7.0 (user goal)
[__2] next goal: ghc (user goal)
[__2] rejecting: ghc-8.6.5/installed-8.6... (conflict: binary==0.8.7.0, ghc =>
binary==0.8.6.0/installed-0.8...)
[__2] trying: ghc-8.6.5
[__3] rejecting: ghc:-buildable (conflict: base==4.12.0.0/installed-4.1...,
ghc -buildable => base<0)
[__3] rejecting: ghc:+buildable (manual flag can only be changed explicitly)
[__3] fail (backjumping, conflict set: base, ghc, ghc:buildable)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: binary, base, ghc, ghc:buildable
Try running with --minimize-conflict-set to improve the error message.
I am using cabal 3.0.0.0 and have ghc 8.6.5 installed.

To me, this looks like you have a version of binary installed that isn't compatible with the boot libraries that come with the compiler. I recommend that you edit the file
~/.ghc/<something>-8.6.5/environments/default
and delete the line that mentions binary, then try again. (The <something> is almost certainly x86_64-linux.)

Related

Cabal: Can't install a specific version of the package (with message "only already installed instances can be used")

I've been trying to install some package:
PS C:\Users\Neo> cabal install template-haskell-2.15.0.0
Resolving dependencies...
cabal-3.6.2.0.exe: Could not resolve dependencies:
[__0] next goal: template-haskell (user goal)
[__0] rejecting: template-haskell-2.19.0.0, template-haskell-2.18.0.0,
template-haskell-2.17.0.0, template-haskell-2.16.0.0 (constraint from user
target requires ==2.15.0.0)
[__0] rejecting: template-haskell-2.15.0.0 (only already installed instances
can be used)
[__0] rejecting: template-haskell-2.14.0.0, template-haskell-2.13.0.0,
template-haskell-2.12.0.0, template-haskell-2.11.1.0,
template-haskell-2.11.0.0, template-haskell-2.10.0.0,
template-haskell-2.9.0.0, template-haskell-2.8.0.0, template-haskell-2.7.0.0,
template-haskell-2.6.0.0, template-haskell-2.5.0.0, template-haskell-2.4.0.1,
template-haskell-2.4.0.0, template-haskell-2.3.0.1, template-haskell-2.3.0.0,
template-haskell-2.2.0.0 (constraint from user target requires ==2.15.0.0)
[__0] fail (backjumping, conflict set: template-haskell)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: template-haskell
What does the message "only already installed instances can be used" actually mean?
Unlike most packages, template-haskell can't be installed, upgraded, or downgraded separately from GHC. If you really need to downgrade to template-haskell-2.15.0.0, then you need to downgrade to GHC 8.8.4. https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history has a chart that lets you check which GHC version corresponds to which library versions.

Cannot compile a haskell project using cabal

I'm trying to compile a haskell project using cabal, but when I execute
cabal configure appears:
Could not resolve dependencies:
[__0] trying: MM-0.1.0.0 (user goal)
[__1] next goal: base (dependency of MM)
[__1] rejecting: base-4.12.0.0/installed-4.1... (conflict: MM => base>=4.9 &&
<4.10)
[__1] fail (backjumping, conflict set: MM, base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: MM, base
Trying configure anyway.
Configuring MM-0.1.0.0...
cabal: Encountered missing dependencies:
base ==4.9.*, cassava ==0.5.*, containers ==0.5.*, time ==1.6.*
I tried using cabal new-build and cabal install --only-dependencies but it still doesn´t work.
The program you're installing needs base 4.9.x.x, which means GHC 8.0.x. Your GHC is too new. Downgrade to 8.0.2, or look for a newer version of the program you're trying to install.

Whenever I try to install a new package on Cabal, it tries and fails to install a previously failed install

In the past I tried to install Clipboard via Cabal, unknowing it only works on 32-bit Windows, so it failed. Now, I'm trying to install utf8-string via Cabal, but when I run the command cabal new-install utf8-string I get the following:
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: Clipboard-2.3.2.0 (user goal)
[__1] next goal: Win32 (dependency of Clipboard)
[__1] rejecting: Win32-2.6.1.0/installed-2.6..., Win32-2.8.5.0, Win32-2.8.4.0,
Win32-2.8.3.0, Win32-2.8.2.0, Win32-2.8.1.0, Win32-2.8.0.0, Win32-2.7.0.0,
Win32-2.6.2.0, Win32-2.6.1.0, Win32-2.6.0.0, Win32-2.5.4.1, Win32-2.5.3.0,
Win32-2.5.2.0, Win32-2.5.1.0, Win32-2.5.0.0, Win32-2.4.0.0 (conflict:
Clipboard => Win32>=2.2.0.0 && <2.4)
[__1] trying: Win32-2.3.1.1
[__2] trying: base-4.12.0.0/installed-4.1... (user goal)
[__3] next goal: ghc (user goal)
[__3] rejecting: ghc-8.6.5/installed-8.6... (conflict: Win32==2.3.1.1, ghc =>
Win32==2.6.1.0/installed-2.6...)
[__3] rejecting: ghc-8.6.5 (conflict: base==4.12.0.0/installed-4.1..., ghc =>
base<0 && ==4.12.*)
[__3] rejecting: ghc-8.6.4, ghc-8.6.1, ghc-8.4.4, ghc-8.4.3, ghc-8.4.1,
ghc-8.2.2, ghc-8.2.1 (constraint from user target requires ==8.6.5)
[__3] fail (backjumping, conflict set: Win32, base, ghc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: ghc, Win32, base, Clipboard
In case it's important, I'm running Windows 10 64-bit, and I'm using Cygwin64 Terminal.
Cabal Dependency Failure: A story of two tools
You: Cabal! Install something old.
Cabal: Can do. And for my buddy GHC I will also record this something old in $HOME/.ghc/$arch-$ghc_version/environments/default.
You: Cabal! Install something else.
Cabal: Ok. Let me check what packages I should install for that. Yeah now I have that list... it says here I should install new thing - but an old version of new thing is mandated by the default environment.
Finding your way out
The Terminator
Screw the old environment, I don't care.
rm $HOME/.ghc/*/environments/default
The Librarian
I like my old environment, let's build this package with a new environment.
cabal install --package-env some-new-named-package-environment utf8-string
The Programmer
I like directory-based workflows and don't really want to think about environments, how about you think about that for me, cabal.
cabal install --lib utf8-string --package-env .
The Programmer (Summer 2020, I hope)
I like directory-based workflows and don't want to talk about environments. Luckily someone fixed the underlying issue https://github.com/haskell/cabal/issues/5559 so now I can just type cabal install --lib utf8-string.

What can I do to install sort package (Haskell) that keeps failing?

I am trying to install the sort package (Haskell), but it keeps failing even though I have the latest version of cabal.
So I updated my cabal : cabal update
But when I run cabal install sort, it failed. Then I tried to run it with --minimize-conflict-set, but it did not work as well. What can I do?
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: base-4.12.0.0/installed-4.1... (user goal)
[__1] next goal: binary (user goal)
[__1] rejecting: binary-0.8.7.0 (constraint from user target requires
==0.8.6.0)
[__1] trying: binary-0.8.6.0/installed-0.8...
[__2] next goal: containers (user goal)
[__2] rejecting: containers-0.6.2.1 (conflict: binary =>
containers==0.6.0.1/installed-0.6...)
[__2] rejecting: containers-0.6.1.1, containers-0.6.0.1/installed-0.6...,
containers-0.6.0.1, containers-0.5.11.0, containers-0.5.10.2,
containers-0.5.10.1, containers-0.5.9.2, containers-0.5.8.2,
containers-0.5.7.1, containers-0.5.7.0, containers-0.5.6.3,
containers-0.5.6.2, containers-0.5.6.1, containers-0.5.6.0,
containers-0.5.5.1, containers-0.5.5.0, containers-0.5.4.0,
containers-0.5.3.1, containers-0.5.3.0, containers-0.5.2.1,
containers-0.5.2.0, containers-0.5.1.0, containers-0.5.0.0,
containers-0.4.2.1, containers-0.4.2.0, containers-0.4.1.0,
containers-0.4.0.0, containers-0.3.0.0, containers-0.2.0.1,
containers-0.2.0.0, containers-0.1.0.1, containers-0.1.0.0,
containers-0.5.9.1, containers-0.5.8.1 (constraint from user target requires
==0.6.2.1)
[__2] fail (backjumping, conflict set: binary, containers)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: binary, containers, base, ghc
Try running with --minimize-conflict-set to improve the error message.
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: base-4.12.0.0/installed-4.1... (user goal)
[__1] trying: containers-0.6.2.1 (user goal)
[__2] next goal: ghc (user goal)
[__2] rejecting: ghc-8.6.5/installed-8.6... (conflict: containers==0.6.2.1,
ghc => containers==0.6.0.1/installed-0.6...)
[__2] rejecting: ghc-8.6.5 (conflict: base==4.12.0.0/installed-4.1..., ghc =>
base<0 && ==4.12.*)
[__2] rejecting: ghc-8.6.4, ghc-8.6.1, ghc-8.4.4, ghc-8.4.3, ghc-8.4.1,
ghc-8.2.2, ghc-8.2.1 (constraint from user target requires ==8.6.5)
[__2] fail (backjumping, conflict set: base, containers, ghc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: containers, base, ghc

Cannot install lens with haste-inst

I'm trying to install the lens package to work with haskell.
$ haste-inst install lens
I get the following error:
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.6.0.1/installed-4.6... (user goal)
trying: containers-0.4.1.0/installed- (user goal)
trying: lens-4.9.1 (user goal)
next goal: template-haskell (dependency of lens-4.9.1)
rejecting: template-haskell-2.10.0.0 (conflict:
base==4.6.0.1/installed-4.6..., template-haskell => base==4.8.*)
rejecting: template-haskell-2.9.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.7.*)
rejecting: template-haskell-2.8.0.0 (conflict: containers==0.4.1.0/installed-,
template-haskell => containers==0.5.*)
rejecting: template-haskell-2.7.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.5.*)
rejecting: template-haskell-2.6.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.4.*)
rejecting: template-haskell-2.5.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.3.*)
rejecting: template-haskell-2.4.0.1 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.2.*)
rejecting: template-haskell-2.4.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base>=3 && <4.3)
rejecting: template-haskell-2.3.0.1, 2.3.0.0, 2.2.0.0 (conflict: lens =>
template-haskell>=2.4 && <2.11)
Backjump limit reached (change with --max-backjumps).
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
I believe the sandbox "Note" to be misleading. The sandbox is new and base cannot exist in the sandbox anyway.
What determines the version of base for haste? Installing lens with cabal (for haskell) works fine:
cabal install lens
Edit:
lens-family has worked well as a substitute so far.
Lens depends on Template Haskell which, unfortunately, is not currently supported by Haste.
The way base is currently implemented for Haste makes TH support tricky. However, GHC 7.10 support will require some significant reshuffling anyway, so TH support will probably arrive together with 7.10.

Resources