What can be done to resolve this dependency issue? - haskell

I'm trying to install aeson after resetting ~/.ghc and ~/.cabal.
cabal install aeson gives me the following error message:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: aeson (user goal)
rejecting: aeson-0.9.0.1, 0.9.0.0, 0.8.1.1, 0.8.1.0 (global constraint
requires ==0.8.0.2)
trying: aeson-0.8.0.2
next goal: bytestring (user goal)
rejecting: bytestring-0.10.6.0, 0.10.4.1, 0.10.4.0, 0.10.2.0 (global
constraint requires installed instance)
rejecting: bytestring-0.10.0.2/installed-4f9... (conflict: aeson =>
bytestring>=0.10.4.0)
rejecting: bytestring-0.10.0.2, 0.10.0.1, 0.10.0.0, 0.9.2.1, 0.9.2.0,
0.9.1.10, 0.9.1.9, 0.9.1.8, 0.9.1.7, 0.9.1.6, 0.9.1.5, 0.9.1.4, 0.9.1.3,
0.9.1.2, 0.9.1.1, 0.9.1.0, 0.9.0.4, 0.9.0.3, 0.9.0.2, 0.9.0.1, 0.9 (global
constraint requires installed instance)
Dependency tree exhaustively searched.
The current version of bytestring package in my system is 0.10.2.0. I tried cabal install bytestring --reinstall so that I can have a more recent version of bytestring (thereby solving aeson dependency issue). But that returns a very odd error:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: bytestring (user goal)
rejecting: bytestring-0.10.6.0, 0.10.4.1, 0.10.4.0, 0.10.2.0, 0.10.0.2,
0.10.0.1, 0.10.0.0, 0.9.2.1, 0.9.2.0, 0.9.1.10, 0.9.1.9, 0.9.1.8, 0.9.1.7,
0.9.1.6, 0.9.1.5, 0.9.1.4, 0.9.1.3, 0.9.1.2, 0.9.1.1, 0.9.1.0, 0.9.0.4,
0.9.0.3, 0.9.0.2, 0.9.0.1, 0.9 (global constraint requires installed instance)
Dependency tree exhaustively searched.
I can solve the problem by using sandboxes. But I'm interested to know if there is a nicer method resolve the dependency issue.
Update: Following a suggestion, I removed bytestring by ghc-pkg unregister --force bytestring, which broke some packages and am still not able to install aeson.
Following is the output of ghc-pkg list lists: http://lpaste.net/135108.

Where is your constraint (global constraint
requires ==0.8.0.2) coming from?
~/prog$ cd
~$ mkdir sbox
~$ cd sbox
~/sbox$ HOME=`pwd`
~$ export HOME
~$ cabal install bytestring
Config file path source is default config file.
Config file /home/novadenizen/sbox/.cabal/config not found.
Writing default configuration to /home/novadenizen/sbox/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
cabal: There is no package named 'bytestring'.
You may need to run 'cabal update' to get the latest list of available
packages.
~$ cabal update
Downloading the latest package list from hackage.haskell.org
~$ cabal install aeson
Resolving dependencies...
Downloading bytestring-0.10.6.0...
Downloading dlist-0.7.1.1...
Configuring dlist-0.7.1.1...
Downloading syb-0.5.1...
Downloading transformers-0.4.3.0...
Configuring syb-0.5.1...
Building dlist-0.7.1.1...
Building syb-0.5.1...
Installed dlist-0.7.1.1
Configuring bytestring-0.10.6.0...
Building bytestring-0.10.6.0...
Configuring transformers-0.4.3.0...
Installed syb-0.5.1
Building transformers-0.4.3.0...
Installed transformers-0.4.3.0
Downloading mtl-2.2.1...
Downloading primitive-0.6...
Configuring primitive-0.6...
Building primitive-0.6...
Configuring mtl-2.2.1...
Installed primitive-0.6
Downloading vector-0.10.12.3...
Building mtl-2.2.1...
Configuring vector-0.10.12.3...
Installed mtl-2.2.1
Building vector-0.10.12.3...
Installed bytestring-0.10.6.0
Downloading binary-0.7.5.0...
Configuring binary-0.7.5.0...
Building binary-0.7.5.0...
Installed binary-0.7.5.0
Downloading text-1.2.1.1...
Configuring text-1.2.1.1...
Building text-1.2.1.1...
Installed vector-0.10.12.3
Installed text-1.2.1.1
Downloading hashable-1.2.3.2...
Configuring hashable-1.2.3.2...
Building hashable-1.2.3.2...
Installed hashable-1.2.3.2
Downloading scientific-0.3.3.8...
Downloading unordered-containers-0.2.5.1...
Configuring scientific-0.3.3.8...
Configuring unordered-containers-0.2.5.1...
Building scientific-0.3.3.8...
Building unordered-containers-0.2.5.1...
Installed scientific-0.3.3.8
Downloading attoparsec-0.13.0.0...
Configuring attoparsec-0.13.0.0...
Building attoparsec-0.13.0.0...
Installed unordered-containers-0.2.5.1
Installed attoparsec-0.13.0.0
Downloading aeson-0.9.0.1...
Configuring aeson-0.9.0.1...
Building aeson-0.9.0.1...
Installed aeson-0.9.0.1
~$

Related

cabal: Encountered missing dependencies:

I am trying to install a Haskell program (itself a compiler for another programming language) from the Github repository.
The Elm compiler is itself a Haskell program and I would like to compile it from source:
$ cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: elm-0.19.1 (user goal)
next goal: zip-archive (dependency of elm-0.19.1)
Dependency tree exhaustively searched.
Trying configure anyway.
Configuring elm-0.19.1...
cabal: Encountered missing dependencies:
SHA -any,
ansi-terminal ==0.8.*,
ansi-wl-pprint >=0.6.8 && <0.7,
containers >=0.5.8.2 && <0.6,
If I try to use a different command the computer searches for a different version of the Elm programming language.
$ cabal install elm
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: Elm-0.13 (user goal)
trying: base-4.12.0.0/installed-4.1... (dependency of Elm-0.13)
next goal: transformers (dependency of Elm-0.13)
rejecting: transformers-0.5.6.2/installed-0.5..., transformers-0.6.0.2,
transformers-0.5.6.2, transformers-0.5.5.2, transformers-0.5.5.0,
transformers-0.5.4.0, transformers-0.5.2.0, transformers-0.5.1.0,
transformers-0.5.0.1, transformers-0.5.0.0 (conflict: Elm => transformers>=0.2
&& <0.5)
rejecting: transformers-0.4.3.0, transformers-0.4.2.0 (conflict:
I already have Elm installed globally and I would like to install a local copy that I cloned from Github. The cabal documentation doesn't say much.
Helpful information:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
Trying different things possibly at risk:
$ cabal install --only-dependencies
Resolving dependencies...
internal error: could not construct a valid install plan.
The proposed (invalid) plan contained the following problems:
Package time is required by several packages, but they require inconsistent
versions:
package zip-archive-0.3.3 requires time-1.10
package snap-server-1.1.2.0 requires time-1.10
package snap-core-1.0.4.2 requires time-1.10
package io-streams-1.5.2.1 requires time-1.10
package http-client-0.6.4.1 requires time-1.10
package elm-0.19.1 requires time-1.10
package directory-1.3.6.2 requires time-1.10
package cookie-0.4.5 requires time-1.10
package HTTP-4000.3.16 requires time-1.10
package unix-2.7.2.2 requires time-1.8.0.2
Proposed plan:
Configured HTTP-4000.3.16 (.fake.HTTP-4000.3.16)
Configured SHA-1.6.4.4 (.fake.SHA-1.6.4.4)
Configured ansi-terminal-0.8.2 (.fake.ansi-terminal-0.8.2)
Configured ansi-wl-pprint-0.6.8.2 (.fake.ansi-wl-pprint-0.6.8.2)
Configured asn1-encoding-0.9.6 (.fake.asn1-encoding-0.9.6)
Configured asn1-parse-0.9.5 (.fake.asn1-parse-0.9.5)
Configured asn1-types-0.3.4 (.fake.asn1-types-0.3.4)
Your cabal is very old, and I strongly recommend you upgrade.
That said... with cabal-1, the invocation is simply
cabal install
with no elm at the end. Run it from within the directory you cloned from github that has a file named elm.cabal or similar -- it will automatically look for a file with extension .cabal and install the package described inside. cabal install will also take care of installing the missing dependencies.
With modern cabal, and assuming the executable named in the .cabal file is called elm, I would use
cabal run elm -- --args --for --elm --compiler
to run the compiler during testing, and then
cabal install --exe
when you are satisfied with your changes and want to make the executable available more widely.

Nix Cabal Not Finding Dependencies

Trying a nix build on nix-os:
cabal --enable-nix install
Resolving dependencies...
Configuring alex-3.2.4...
Configuring happy-1.19.9...
Configuring c2hs-0.28.3...
Building alex-3.2.4...
Building c2hs-0.28.3...
Building happy-1.19.9...
Installed alex-3.2.4
Installed happy-1.19.9
Installed c2hs-0.28.3
Configuring PathFinder-0.1.0.0...
Failed to install PathFinder-0.1.0.0
Build log ( /home/liminal18/.cabal/logs/ghc-7.10.3/PathFinder-0.1.0.0-Ct8hE4tpk2v4C0mK830b0v.log ):
cabal: Entering directory '.'
Configuring PathFinder-0.1.0.0...
cabal: The following package dependencies were requested
--dependency='alex=alex-3.2.4-EcO8GwV5VLDHmJwcir1l4u'
--dependency='c2hs=c2hs-0.28.3-ConONz4xJmFDgUCTAA6Wmq'
--dependency='happy=happy-1.19.9-4PZ32S6SvwZBaSXkci9sAS'
however the given installed package instance does not exist.
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
PathFinder-0.1.0.0-Ct8hE4tpk2v4C0mK830b0v failed during the configure step.
The exception was:
ExitFailure 1
I get the same error with out --enable-nix
cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: PathFinder-0.1.0.0 (user goal)
unknown package: c2hs (dependency of PathFinder-0.1.0.0)
fail (backjumping, conflict set: PathFinder, c2hs)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: PathFinder, c2hsTrying configure
anyway.
Configuring PathFinder-0.1.0.0...
cabal: Encountered missing dependencies:
alex -any, c2hs -any, happy -any
source code for the project is here:
https://github.com/aljones15/SimplePathFinding
I can do cabal install for c2hs just fine and the other dependencies however my build script just doesn't seem to work on nix-os. let me know if you can solve this. I think I just have something configured wrong.
In the cabal file, you should use the build-tool-depends field instead of build-depends for executables you depend on.

Is everything reinstalled from scratch in cabal sandboxes?

Let's assume the following procedure:
cd /home/user/experiment
git clone https://github.com/ryantrinkle/reflex.git
cabal sandbox init
cabal install --dependencies-only
Question:
At this point what packages will the sandbox in /home/user/experiment contain ? Will it contain the whole dependency hierarchy tree of Reflex ?
In other words, if Reflex is the root package then will the whole dependency tree of Reflex be compiled from scratch independently of what is installed already in the global package repository of cabal ?
I suspect yes, but I am not sure.
When I execute the above command sequence then the following packages are installed :
[vagrant#localhost reflex]$ cabal install --only-dependencies
Resolving dependencies...
Notice: installing into a sandbox located at /home/vagrant/reflex
Downloading dependent-sum-0.2.1.0...
Configuring base-orphans-0.3.3...
Downloading primitive-0.5.4.0...
Configuring mtl-2.2.1...
Building base-orphans-0.3.3...
Building mtl-2.2.1...
Installed base-orphans-0.3.3
Configuring nats-1...
Building nats-1...
Installed nats-1
Configuring stm-2.4.4...
Configuring tagged-0.8.0.1...
Installed mtl-2.2.1
Building stm-2.4.4...
Building tagged-0.8.0.1...
Configuring text-1.2.1.1...
Installed stm-2.4.4
Downloading ref-tf-0.4...
Configuring transformers-compat-0.4.0.4...
Installed tagged-0.8.0.1
Building text-1.2.1.1...
Building transformers-compat-0.4.0.4...
Configuring dependent-sum-0.2.1.0...
Installed transformers-compat-0.4.0.4
Building dependent-sum-0.2.1.0...
Configuring primitive-0.5.4.0...
Installed dependent-sum-0.2.1.0
Downloading dependent-map-0.1.1.3...
Building primitive-0.5.4.0...
Installed primitive-0.5.4.0
Configuring ref-tf-0.4...
Building ref-tf-0.4...
Installed ref-tf-0.4
Configuring StateVar-1.1.0.0...
Building StateVar-1.1.0.0...
Configuring distributive-0.4.4...
Installed StateVar-1.1.0.0
Building distributive-0.4.4...
Configuring dependent-map-0.1.1.3...
Installed distributive-0.4.4
Building dependent-map-0.1.1.3...
Configuring vector-0.10.12.3...
Installed dependent-map-0.1.1.3
Building vector-0.10.12.3...
Installed text-1.2.1.1
Configuring hashable-1.2.3.2...
Building hashable-1.2.3.2...
Installed hashable-1.2.3.2
Configuring unordered-containers-0.2.5.1...
Building unordered-containers-0.2.5.1...
Installed unordered-containers-0.2.5.1
Configuring semigroups-0.16.2.2...
Building semigroups-0.16.2.2...
Installed semigroups-0.16.2.2
Configuring void-0.7...
Configuring bifunctors-5...
Installed vector-0.10.12.3
Building void-0.7...
Building bifunctors-5...
Installed void-0.7
Configuring contravariant-1.3.1.1...
Building contravariant-1.3.1.1...
Installed contravariant-1.3.1.1
Configuring comonad-4.2.6...
Installed bifunctors-5
Building comonad-4.2.6...
Installed comonad-4.2.6
Configuring profunctors-5.1.1...
Configuring semigroupoids-5.0.0.2...
Building profunctors-5.1.1...
Building semigroupoids-5.0.0.2...
Installed profunctors-5.1.1
Installed semigroupoids-5.0.0.2
Downloading these-0.4.1...
Configuring these-0.4.1...
Building these-0.4.1...
Installed these-0.4.1
This seems an awful lot.
Are these exactly the packages contained in the dependency tree of Reflex ?
I suspect yes, but I am not sure, hence this question.
Not quite. At the moment, anything in the global package database is also used by sandboxes. I believe future versions of cabal-install will restrict this to a few whitelisted core packages that ship with GHC (and that shouldn't/can't be replaced anyway).

Cabal configure in a sandbox complains "At least the following dependencies are missing" on installed packages

I have a project, it's inside a sandbox, I introduced a test-suite in my cabal file and it build-depends on hunit ==1.2.*. The problem is when I try to configure:
$ cabal configure --enable-tests
Resolving dependencies...
Configuring MyProject-0.1.0.0...
cabal: At least the following dependencies are missing:
hunit ==1.2.*
A few more attempts to get it to come around:
$ cabal install --dependencies-only
Resolving dependencies...
All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.
&
$ cabal install hunit
Resolving dependencies...
All the requested packages are already installed:
HUnit-1.2.5.2
Use --reinstall if you want to reinstall anyway.
&
$ cabal install --enable-tests
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: MyProject-0.1.0.0 (user goal)
rejecting: MyProject-0.1.0.0:!test (global constraint requires opposite flag
selection)
trying: MyProject-0.1.0.0:*test
next goal: hunit (dependency of MyProject-0.1.0.0:*test)
fail (unknown package: hunit)
Dependency tree exhaustively searched.
--reinstalling did nothing.
I even played with the --user and --global flags, even tho I'm using cabal and not runhaskell, it doesn't help it.
I also tried to delete & re-init the sandbox.
I tried just deleteing the sandbox too, and it still gave me the same error.
ghc-pkg check finds nothing wrong.
What could it be?
By the way a part of me is suspicious that cabal ignores that my project is in a sandbox, since it didn't bother to install some packages that were already on my machine; it does so on my Windows (this is on Ubuntu). Is it possible to get that checked?
Ubuntu 14.04.1 LTS
GHC version: 7.6.3
cabal-install version: 1.20.0.3
Cabal library version: 1.20.0.2
Also tried now with cabal-install 1.16.0.2 without success.
Package names are case sensitive in Cabal/Hackage, the correct package name is HUnit. Change the line in your cabal file containing:
hunit ==1.2.*
To
HUnit ==1.2.*

Haskell Yesod start project error

Install Yesod Web-framework. Initialize project, then start it. Get an error:
cabal: The following installed packages are broken because other packages they
depend on are missing. These broken packages must be rebuilt before they can
be used.
package persistent-1.1.5.1 is broken due to missing package
aeson-0.6.2.0-0b5b1be15e07744226b068e794d3d16c
package persistent-postgresql-1.1.3.1 is broken due to missing package
aeson-0.6.2.0-0b5b1be15e07744226b068e794d3d16c
package persistent-template-1.1.3.1 is broken due to missing package
aeson-0.6.2.0-0b5b1be15e07744226b068e794d3d16c
package shakespeare-js-1.1.4.1 is broken due to missing package
aeson-0.6.2.0-0b5b1be15e07744226b068e794d3d16c
package yaml-0.8.5 is broken due to missing package
aeson-0.6.2.0-0b5b1be15e07744226b068e794d3d16c
But the aeson-0.6.2 package already installed:
cabal install aeson-0.6.2
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: aeson (user goal)
rejecting: aeson-0.6.2.0/installed-353..., 0.6.2.0, 0.6.1.0/installed-23c...,
0.6.1.0, 0.6.0.2, 0.6.0.1, 0.6.0.0, 0.5.0.0, 0.4.0.1, 0.4.0.0, 0.3.2.14,
0.3.2.13, 0.3.2.12, 0.3.2.11, 0.3.2.10, 0.3.2.9, 0.3.2.8, 0.3.2.7, 0.3.2.6,
0.3.2.5, 0.3.2.4, 0.3.2.3, 0.3.2.2, 0.3.2.1, 0.3.2.0, 0.3.1.1, 0.3.1.0,
0.3.0.0, 0.2.0.0, 0.1.0.0 (global constraint requires ==0.6.2)
How to resolve this problem?

Resources