yesod with stackage is failing to install due to dependency problems - haskell

I tried to set up a yesod project as follows:
mkdir sample_blog
curl -o cabal.config www.stackage.org/nightly/cabal.config
cabal install alex happy yesod-bin
However, I got the following error:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: Cabal (user goal)
rejecting: Cabal-1.18.1.4/installed-d6c... (global constraint requires
==1.18.1.3)
trying: Cabal-1.18.1.3/installed-476...
trying: yesod-bin-1.4.2 (user goal)
next goal: ghc (dependency of yesod-bin-1.4.2)
rejecting: ghc-7.8.3/installed-1d5... (conflict:
Cabal==1.18.1.3/installed-476..., ghc => Cabal==1.18.1.4/installed-d6c...)
Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
I've install GHC and cabal-install using homebrew.
Versions:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
$ cabal --version
cabal-install version 1.20.0.4
using version 1.20.0.3 of the Cabal library

It appears that homebrew has patched the standard GHC installation, as it's shipping with a different version of the Cabal library than the official GHC. I don't know why that is occurring. A quick workaround would be to remove the Cabal line from your cabal.config. Can you open up an issue against Stackage about this? I'd like to get to the bottom of why this is occurring.

Related

cabal build fails with (conflict: requires GHC2021) it's unclear what this is?

cabal build myproject
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: plutarch (user goal)
[__0] rejecting: plutarch-1.3.0 (conflict: requires GHC2021)
[__0] fail (backjumping, conflict set: plutarch)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: plutarch
I'm running into the above error (conflict: requires GHC2021) however it is not clear what this is? It does not seem to be a package? There is various mentions of GHC2021 in a web search but I still don't understand what this conflict is?
https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/control.html seems to indicate it is a language spec, but I'm not sure where this should perhaps be specified?
More info:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.2
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
cabal.project:
packages: myproject/
source-repository-package
type: git
location: https://github.com/Plutonomicon/plutarch-plutus.git
tag: 01a67f56b2bf428538e92ed9ada0ce88d90ab636
Fixed when updating GHC to 9.4.3 and cabal to 3.6.2.

Why can't I cabal install template-haskell-2.17.0.0?

I am trying to install the specific version template-haskell-2.17.0.0. I run this command, but get an error during dependency resolution:
❯ cabal install template-haskell-2.17.0.0 --lib
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: template-haskell (user goal)
[__0] rejecting: template-haskell-2.18.0.0 (constraint from user target
requires ==2.17.0.0)
[__0] rejecting: template-haskell-2.17.0.0 (constraint from user target
requires ==2.16.0.0)
[__0] rejecting: template-haskell-2.16.0.0/installed-2.16.0.0,
template-haskell-2.16.0.0, template-haskell-2.15.0.0,
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.17.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
I'm using the latest cabal version:
❯ cabal --version
cabal-install version 3.6.2.0
compiled using version 3.6.3.0 of the Cabal library
Some packages come with GHC and cannot be reinstalled. These are known as "boot" packages. The template-haskell package is one of these boot packages. You can find a complete list of them here: https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/libraries/version-history.
For your particular case, template-haskell-2.17.0.0 is part of GHC 9.0.2 (or 9.0.1). The only way to install that version of template-haskell is to use the appropriate version of GHC.
Based on the error output, I'm guessing that you're using some version of GHC 8.10.x, probably 8.10.7. You don't mention how you installed GHC, so I don't know exactly how to tell you to upgrade. If you used GHCup, then you should be able to upgrade GHC with this command:
ghcup install ghc 9.0.2 --set

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.

cabal sandbox dependencies not found

I have a problem when I work with cabal sandbox, I created a sandbox for a 'hello world' application but when I try to run cabal install --only-dependencies I get the following error:
$ cabal install --only-dependencies
Resolving dependencies... cabal: Could not resolve dependencies:
trying: haskeline-0.7.2.1/installed-dad... (user goal) next goal:
helloworld (user goal) rejecting: helloworld-0.1.0.0 (conflict:
haskeline => base==4.7.0.2/installed-918..., helloworld => base>=4.8
&& <4.9) Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have
consistent dependencies. Try reinstalling/unregistering the offending
packages or recreating the sandbox.
I want to mention that if I try to run on this sandbox cabal repl I get the error.
$ cabal repl
Package has never been configured. Configuring with default flags. If
this fails, please run configure manually. Resolving dependencies...
Configuring helloworld-0.1.0.0... cabal: At least the following
dependencies are missing: base ==4.8.*
If I run cabal repl outside of sandbox everything is working ok.
If any of you have an idea pls share with me :),
thanks
sorin
It looks like your version constraints want you to use GHC 7.10- which bundles base version 4.8- while you're using GHC 7.8 and base 4.7. You could:
Modify the cabal file and its base version bounds
Switch to a different version of GHC
Try building with stack, which will automatically detect those kinds of things during stack init and then offer to install the appropriate GHC for you.

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

Resources