`cabal install vector` fails - haskell

$ cabal install vector
Resolving dependencies... Error: cabal: Could not resolve dependencies:
[__0] trying: vector-0.13.0.0 (user goal)
[__1] trying: primitive-0.6.4.0 (dependency of vector)
[__2] next goal: base (dependency of vector)
[__2] rejecting: base-4.16.3.0/installed-4.16.3.0 (conflict: primitive => base>=4.5 && <4.13)
[__2] rejecting: 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)
[__2] fail (backjumping, conflict set: base, primitive, vector) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, vector, primitive
$ ghc --version && cabal --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
cabal-install version 3.8.1.0
compiled using version 3.8.1.0 of the Cabal library
I'm not sure, but it seems primitive and base are conflict packages?
$ uname -a
Darwin MacBook-Pro-2.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
-v3 output is pasted here:
https://pastebin.com/sfNWXB8R
$ ghc-pkg list
/usr/local/Cellar/ghc/8.10.7_1/lib/ghc-8.10.7/package.conf.d
Cabal-3.2.1.0
array-0.5.4.0
base-4.14.3.0
binary-0.8.8.0
bytestring-0.10.12.0
containers-0.6.5.1
deepseq-1.4.4.0
directory-1.3.6.0
exceptions-0.10.4
filepath-1.4.2.1
ghc-8.10.7
ghc-boot-8.10.7
ghc-boot-th-8.10.7
ghc-compact-0.1.0.0
ghc-heap-8.10.7
ghc-prim-0.6.1
ghci-8.10.7
haskeline-0.8.2
hpc-0.6.1.0
integer-gmp-1.0.3.0
libiserv-8.10.7
mtl-2.2.2
parsec-3.1.14.0
pretty-1.1.3.6
process-1.6.13.2
rts-1.0.1
stm-2.5.0.1
template-haskell-2.16.0.0
terminfo-0.4.1.4
text-1.2.4.1
time-1.9.3
transformers-0.5.6.2
unix-2.7.2.2
xhtml-3000.2.2.1

Related

How to let `cabal install` ignore the local `.cabal` file?

Versions
%cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library
%ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.7
Problem
I want to install weeder. If there is no *.cabal file in the current directory, running cabal install weeder succeeds. However, if the one exists and contains a dependency that conflicts with what weeder requires, cabal install weeder fails.
For example, if a .cabal file contains text < 1.2.3.0 as build-depends, cabal install weeder fails with the message below:
%cabal install weeder
cabal: Could not resolve dependencies:
[__0] trying: foobarbaz-0.1.0.0 (user goal)
[__1] next goal: text (dependency of foobarbaz)
[__1] rejecting: text-1.2.4.1/installed-1.2.4.1 (conflict: foobarbaz =>
text<1.2.3.0)
[__1] skipping: text-1.2.5.0, text-1.2.4.1, text-1.2.4.0, text-1.2.3.2,
text-1.2.3.1, text-1.2.3.0 (has the same characteristics that caused the
previous version to fail: excluded by constraint '<1.2.3.0' from 'foobarbaz')
[__1] trying: text-1.2.2.2
[__2] next goal: deepseq (dependency of text)
[__2] rejecting: deepseq-1.4.4.0/installed-1.4.4.0 (conflict: text =>
base>=4.2 && <4.11, deepseq => base==4.14.3.0/installed-4.14.3.0)
[__2] trying: deepseq-1.4.5.0
[__3] next goal: array (dependency of text)
[__3] rejecting: array-0.5.4.0/installed-0.5.4.0 (conflict: text => base>=4.2
&& <4.11, array => base==4.14.3.0/installed-4.14.3.0)
[__3] trying: array-0.5.4.0
[__4] next goal: base (dependency of foobarbaz)
[__4] rejecting: base-4.14.3.0/installed-4.14.3.0 (conflict: text => base>=4.2
&& <4.11)
[__4] skipping: base-4.16.0.0, base-4.15.0.0, base-4.14.3.0, base-4.14.2.0,
base-4.14.1.0, base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0,
base-4.11.0.0 (has the same characteristics that caused the previous version
to fail: excluded by constraint '>=4.2 && <4.11' from 'text')
[__4] rejecting: 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)
[__4] fail (backjumping, conflict set: base, foobarbaz, text)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, text, deepseq, array, foobarbaz
Try running with --minimize-conflict-set to improve the error message.
I can avoid this by mv foobarbaz.cabal foobarbaz.cabal.bk before cabal install weeder and mv foobarbaz.cabal.bk foobarbaz.cabal after the install, or running cabal install weeder in the other directory. But is there an option to ignore the local .cabal file?
Cabal has a --project-file option. It turns out that when specified empty, this causes cabal-install to not use any project file, even when one is in the current directory.
cabal v2-install --project-file="" weeder
After I posted the question, I found that the -z and --ignore-project options are also what I wanted.
cabal install -z weeder

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.
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.

I am getting this error when trying to install Cardano-Node

cabal: Could not resolve dependencies:
[__0] trying: Win32-network-0.1.0.0 (user goal)
[__1] next goal: base (dependency of Win32-network)
[__1] rejecting: base-4.14.1.0/installed-4.14.1.0 (conflict: Win32-network =>
base>=4.5 && <4.13)
[__1] rejecting: 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: Win32-network, base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, Win32-network
I am doing cabal install cardano-node cardano-cli within my Linux/Ubuntu environment.
Looks like this commit relaxes that constraint suitably. Looks like the master branch of the cardano-node repo already requests a commit later than that, so probably just updating that repo will get you where you need to go.
Install cardano-cli & cardano-node the easy way on Mac:
Download the daedaluswallet.io wallet and install.
nano ~/.zshrc
export PATH=$PATH:/Applications/Daedalus\ Mainnet.app/Contents/MacOS
source ~/.zshrc

Cabal can't install ghc-mod

I'm trying to install ghc-mod to use with Atom-Haskell (the ide-haskell package) in Atom, but for some reason my Cabal doesn't want to.
When I enter the command cabal install ghc-mod, I get the following errors in my terminal:
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: ghc-mod-5.8.0.0 (user goal)
[__1] trying: syb-0.7.1 (dependency of ghc-mod)
[__2] next goal: base (dependency of ghc-mod)
[__2] rejecting: base-4.14.1.0/installed-4.14.1.0 (conflict: ghc-mod =>
base<4.10 && >=4.6.0.1)
[__2] skipping: base-4.14.0.0, 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 (has the same characteristics that
caused the previous version to fail: excluded by constraint '<4.10 &&
>=4.6.0.1' from 'ghc-mod')
[__2] rejecting: 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)
[__2] fail (backjumping, conflict set: base, ghc-mod)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, ghc-mod, syb
I installed Cabal as part of the Haskell Platform, so to my understanding, it's a bit unusually configured. I don't have a %HOME%.cabal folder, and I don't know if that could be part of the issue?
I don't know a lot about how Cabal or ghc-mod work, so please let me know if you need any more info!
Thanks for any help!
You probably have a new version of base, (https://wiki.haskell.org/Base_package) where ghc-mod is only compatible with versions >=4.6.0.1 && <4.10 (https://hackage.haskell.org/package/ghc-mod). You'd have to downgrade.

Dependency conflicts of base in Haskell cabal

There comes up with a problem that cabal's base is conflicted with the dependency in .cabal file, it seems that my base version is too high, so is there a way to downgrade my base package version in the cabal sandbox.
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: decafc-0.0.0 (user goal)
[__1] next goal: base (dependency of decafc)
[__1] rejecting: base-4.11.1.0/installed-4.1... (conflict: decafc => base>=4.5
&& <=4.9)
[__1] rejecting: 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, decafc)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, decafc
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unrstering the offending packages or
recreating the sandbox.
There is another problem that when using stack, how to add some flags to the alex if running stack build, for example, the cabal instruction is cabal install --alex-options="--ghc --template=\"$TOP/alex\"". So how to let the stack do the same things?
The base dependency indicates that it only works with versions between 4.5 and 4.9. That means the latest GHC you can use this package with is 8.0.1, since base ships with GHC and can't be upgraded. You could bump the dependency yourself, but you would likely have to fix things that don't work anymore due to changes in base, or you could install an older version of GHC.

Resources