Lemma
Lemma

Reputation: 79

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.

Upvotes: 3

Views: 223

Answers (1)

Thomas M. DuBuisson
Thomas M. DuBuisson

Reputation: 64740

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.

Upvotes: 4

Related Questions