Haskell cabal-install errors
Asked Answered
R

2

24

I am having lots of problems with cabal-install:
1: Every time I do cabal update, it tells me to do cabal install cabal-install, so I do, and then when I do cabal update again, it says the same thing.

2: When I try to install ghc-mod from hackage, it gives me this error:

[username@arch ~]$ cabal install ghc-mod
In order, the following will be installed:
haskell-src-exts-1.14.0 (reinstall) changes: pretty-1.1.1.1 -> 1.1.1.0
hlint-1.8.55 (reinstall)
ghc-mod-3.1.4
setup: The program happy version >=1.17 is required but it could not be found.
ghc-mod-3.1.4 depends on haskell-src-exts-1.14.0 which failed to install.
haskell-src-exts-1.14.0 failed during the configure step.
hlint-1.8.55 depends on haskell-src-exts-1.14.0 which failed to install.

So the problem was The program happy version >=1.17 is required but it could not be found., so I installed happy 1.19.2 using cabal install happy without problems.

I tried cabal install ghc-mod again, same error, so I tried cabal install haskell-src-exts --reinstall --force-reinstalls. It gave me the following error:

[username@arch ~]$ cabal install haskell-src-exts --reinstall --force-reinstalls
Configuring haskell-src-exts-1.14.0...
setup: The program happy version >=1.17 is required but it could not be found.
Failed to install haskell-src-exts-1.14.0
cabal: Error: some packages failed to install:
haskell-src-exts-1.14.0 failed during the configure step. The exception was:
ExitFailure 1

Basically The program happy version >=1.17 is required but it could not be found.. So happy is the problem again?

I have also tried downloading the tar.gz files from hackage and using cabal install on the .cabal file, also modified the .cabal file to ignore dependencies, still failed.

Redheaded answered 8/12, 2013 at 23:33 Comment(0)
C
31

cabal install places executables in ~/.cabal/bin.

If you add it to your path, you will be able to use the new executables installed by cabal:

$ PATH=$HOME/.cabal/bin:$PATH
Caviar answered 8/12, 2013 at 23:52 Comment(2)
Amazing. I just encountered two really weird things, so I write here in the case it would help someone. The first: I already had the $HOME/.cabal/bin in my $PATH, and… it didn't work! That only start working after I replaced the $HOME with ~ — really funny, because I used the variable being afraid that tilde won't work. The second thing: even after the system saw the path, and the happy — the cabal still didn't! Only after I executed the command from this answer, it start working. My guess is that cabal don't understand tilde either…Effluvium
So, I guess the problem is like this: cabal wants a full path. So, after I added in my /etc/environment in the $PATH the :$HOME/.cabal/bin (either the variant with tilde), the cabal in both cases thinks that tilde or the $HOME is part of the path (it is valid path either). To get it working one have to write into the /etc/environment the full path till the directory with binaries.Effluvium
S
23

I encountered with same problem and I solved the problem with installing happy package(confusing package name). So install it with your package manager(apt-get, pacman etc) before install package with cabal. This should be fix the problem.

Sacrament answered 5/4, 2014 at 17:58 Comment(3)
On a clean install from source of GHC/cabal (no Haskell Platform), installing this fixed a nondescript ExitFailure 1 failure.Cooksey
I was able to fix this by cabal install happy.Bienne
Installing with package manager messed things up in the past for me on Ubuntu. The big problem is apt-get installs one kind of Haskell module but then you start using cabal and you get different versions of the module. Dependency hell conflicts. So the suggestion by @Bienne is best. Using cabal gives you the latest, synchronized version.Dubose

© 2022 - 2024 — McMap. All rights reserved.