I am trying to install the diagrams package. If I do
cabal install diagrams
I get (towards the end)
Configuring lens-4.2...
Building lens-4.2...
Preprocessing library lens-4.2...
src/Control/Lens/Internal/Zoom.hs:47:8:
Could not find module `Control.Monad.Trans.Except'
It is a member of the hidden package `transformers-0.4.1.0'.
Perhaps you need to add `transformers' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Failed to install lens-4.2
cabal: Error: some packages failed to install:
diagrams-1.2 depends on lens-4.2 which failed to install.
diagrams-contrib-1.1.2 depends on lens-4.2 which failed to install.
diagrams-core-1.2.0.1 depends on lens-4.2 which failed to install.
diagrams-lib-1.2.0.1 depends on lens-4.2 which failed to install.
diagrams-svg-1.1 depends on lens-4.2 which failed to install.
force-layout-0.3.0.4 depends on lens-4.2 which failed to install.
lens-4.2 failed during the building phase. The exception was:
ExitFailure 1
So then I try
$cabal install lens transformers diagrams
And I get (towards the end)
In-place registering diagrams-lib-1.2.0.1...
Installing library in /home/theking/.cabal/lib/diagrams-lib-1.2.0.1/ghc-7.6.3
Registering diagrams-lib-1.2.0.1...
Installed diagrams-lib-1.2.0.1
cabal: Error: some packages failed to install:
cairo-0.12.5.3 failed during the configure step. The exception was:
ExitFailure 1
diagrams-0.3 depends on glib-0.12.5.4 which failed to install.
diagrams-cairo-1.2 depends on glib-0.12.5.4 which failed to install.
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1
pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
So I tried one more thing
$ cabal install glib
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/SetupWrapper.hs, /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/Setup.hs, /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/Main.o )
Linking /tmp/glib-0.12.5.4-9179/glib-0.12.5.4/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.12.5.4...
setup: The program gtk2hsC2hs version >=0.13.8 is required but the version
found at /usr/bin/gtk2hsC2hs is version 0.13.6
Failed to install glib-0.12.5.4
cabal: Error: some packages failed to install:
glib-0.12.5.4 failed during the configure step. The exception was:
ExitFailure 1
And I got stuck here. So how do I install diagrams. I don't really care how it gets installed (getting a little fed up with cabal) as long as it gets installed.
Notes: I am on linux. I also tried cabal install gtk2hs-buildtools.
The second error block says that:
diagrams-0.3 depends on glib-0.12.5.4 which failed to install.
diagrams-0.3 is a very old version of diagrams, and in normal circumstances cabal shouldn't be trying to install it. Recent versions of diagrams do not even depend on diagrams-cairo, so as long as you don't need the Cairo backend you can work around the Cairo/GTK issues by asking for the current version of diagrams, as in:
cabal install diagrams-1.2
Ideally, it would be good to find out why your cabal is pulling the old version. cabal install diagrams --dry-run (which only show the packages that would be pulled without actually installing them) and ghc-pkg list (which shows the packages currently in your system) might help figuring that out.
As for the Cairo-related issues, as Daniel Wagner suggests a PATH issue might be preventing cabal from using the latest versions of the gtk2hs-buildtools you have installed. For instance, you might have a global installation of the tools, which is overriding the local one you have done with cabal. ghc-pkg list allows you to verify that. Also, check this relevant question.
Related
On Mac OS X, I'm not able to install ghc-mod due to that a dependency called 'happy' cannot be installed:
bash> cabal install ghc-mod
Resolving dependencies...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/meng/.cabal/logs/haskell-src-exts-1.17.1.log ):
Configuring haskell-src-exts-1.17.1...
setup-Simple-Cabal-1.22.5.0-x86_64-osx-ghc-7.10.3: The program 'happy' version
>=1.19 is required but it could not be found.
cabal: Error: some packages failed to install:
ghc-mod-5.5.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.31 depends on haskell-src-exts-1.17.1 which failed to install.
Any idea?
For some reason, cabal doesn't install executable dependencies, but you can get around this by installing by hand.
cabal install happy
then proceed with the original installation.
This problem generally doesn't go away with stack either, but the solution is similar
stack install happy
then continue with the installation.
it seems the program happy is not installed in your system, therefore the package haskell-src-exts-1.17.1 (a dependency of a dependency of ghc-mod) which depends on it fails to install.
The common wisdom today, especially for beginners, is to not use the tool cabal-install, but to use stack for everything you need instead. including installing ghc itself. after downloading stack I think all you have to do is run stack install ghc-mod to install ghc-mod.
I am having some issues installing packages using cabal. Issuing the following command:
> cabal install ghc-mod stylish-haskell haskell-docs hdevtools
produces these errors
Building yaml-0.8.8.3...
Preprocessing library yaml-0.8.8.3...
<command line>: cannot satisfy -package-id aeson-0.7.0.6-b19228a032fb34be4eef122
913c6e81a
(use -v for more information)
Failed to install yaml-0.8.8.3
cabal: Error: some packages failed to install:
ghc-mod-4.1.1 depends on haskell-src-exts-1.15.0.1 which failed to install.
haskell-docs-0.2.0.0 failed during the building phase. The exception was:
ExitFailure 1
haskell-src-exts-1.15.0.1 failed while unpacking the package. The exception
was:
C:\Users\Arnob\AppData\Local\Temp\haskell-src-exts-1.15.0.1-5840\haskell-src-ext
s-1.15.0.1\dist-tmp:
MoveFileEx
"C:\\Users\\Arnob\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-5840\\haskell
-src-exts-1.15.0.1\\dist-tmp"
"C:\\Users\\Arnob\\AppData\\Local\\Temp\\haskell-src-exts-1.15.0.1-5840\\haskell
-src-exts-1.15.0.1\\dist":
permission denied (Access is denied.)
hdevtools-0.1.0.5 depends on unix-2.7.0.1 which failed to install.
hlint-1.8.61 depends on haskell-src-exts-1.15.0.1 which failed to install.
stylish-haskell-0.5.10.0 depends on yaml-0.8.8.3 which failed to install.
unix-2.7.0.1 failed during the configure step. The exception was:
ExitFailure 1
yaml-0.8.8.3 failed during the building phase. The exception was:
ExitFailure 1
I have also tried installing the windows fork of hdevltools by running
> cabal install
on the cloned github repo. However this also produces errors.
As a last ditch effort, I tried changing the remote repo to "stackage", i.e.
remote-repo: stackage: http://www.stackage.org/stackage/44ea140bd97cbb0f6140d331f8f7f8667a637eda
but this did not help either.
All help is appreciated!
It looks like this is a Windows specific issue, where cabal cannot move some required files in the haskell-src-exts distribution (the issue is also seen in other packages, such as pandoc). This might be related to the issue reported here: https://github.com/haskell/cabal/issues/1698
I was able to get the haskell-src-exts package installed by doing the following:
> cabal unpack haskell-src-exts
> cd haskell-src-exts
> cabal install
Your problem is listed right in Cabal's error message:
MoveFileEx ... ...:
permission denied (Access is denied.)
So it seems you have a permission problem with your Windows installation (or at least your user temp folder), which is why Cabal stumbles.
Deciding to learn Haskell, installed ghc on OS X via Homebrew (web binaries weren't downloading at the time).
All great, following along with Learn You a Haskell, but then decided to install some packages and see how things run.
cabal install clckwrks-cli was running fine until...
Public internet craps out half-way through install/build of a few projects.
Now, none of those programs will reinstall and in the case of clckwrks-cli, I get the following error:
$ cabal install clckwrks-cli --reinstall --force-reinstalls
Resolving dependencies...
Failed to install cipher-aes-0.2.6
Failed to install cipher-rc4-0.1.4
Failed to install cookie-0.4.0.1
Failed to install crypto-numbers-0.2.3
Configuring happstack-hsp-7.2.4...
Building happstack-hsp-7.2.4...
Preprocessing library happstack-hsp-7.2.4...
ghc: could not execute: hsx2hs
Failed to install happstack-hsp-7.2.4
Failed to install lifted-base-0.2.2.0
Failed to install publicsuffixlist-0.1
Failed to install pwstore-purehaskell-2.1.1
Configuring reform-hsp-0.2.4...
Building reform-hsp-0.2.4...
Preprocessing library reform-hsp-0.2.4...
ghc: could not execute: hsx2hs
Failed to install reform-hsp-0.2.4
Failed to install web-plugins-0.2.5
Failed to install wl-pprint-text-1.1.0.2
Failed to install xml-types-0.3.4
cabal: Error: some packages failed to install:
attoparsec-conduit-1.0.1.2 depends on lifted-base-0.2.2.0 which failed to
install.
authenticate-1.3.2.6 depends on xml-types-0.3.4 which failed to install.
blaze-builder-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to
install.
cipher-aes-0.2.6 failed while unpacking the package. The exception was:
user error (data is not in tar format)
cipher-rc4-0.1.4 failed while unpacking the package. The exception was:
user error (data is not in tar format)
clckwrks-0.21.1 depends on xml-types-0.3.4 which failed to install.
clckwrks-cli-0.2.10 depends on xml-types-0.3.4 which failed to install.
conduit-1.0.14 depends on lifted-base-0.2.2.0 which failed to install.
cookie-0.4.0.1 failed while unpacking the package. The exception was:
user error (data is not in tar format)
cprng-aes-0.5.2 depends on cipher-aes-0.2.6 which failed to install.
crypto-numbers-0.2.3 failed while unpacking the package. The exception was:
user error (data is not in tar format)
crypto-pubkey-0.2.4 depends on crypto-numbers-0.2.3 which failed to install.
fb-0.14.11 depends on publicsuffixlist-0.1 which failed to install.
happstack-authenticate-0.10.10 depends on xml-types-0.3.4 which failed to
install.
happstack-hsp-7.2.4 failed during the building phase. The exception was:
ExitFailure 1
hsx-jmacro-7.3.4 depends on wl-pprint-text-1.1.0.2 which failed to install.
http-conduit-1.9.6 depends on publicsuffixlist-0.1 which failed to install.
jmacro-0.6.8 depends on wl-pprint-text-1.1.0.2 which failed to install.
lifted-base-0.2.2.0 failed while unpacking the package. The exception was:
user error (data is not in tar format)
monad-logger-0.3.4.0 depends on lifted-base-0.2.2.0 which failed to install.
publicsuffixlist-0.1 failed while unpacking the package. The exception was:
user error (data is not in tar format)
pwstore-purehaskell-2.1.1 failed while unpacking the package. The exception
was:
user error (data is not in tar format)
reform-hsp-0.2.4 failed during the building phase. The exception was:
ExitFailure 1
resourcet-0.4.10 depends on lifted-base-0.2.2.0 which failed to install.
tls-1.1.5 depends on crypto-numbers-0.2.3 which failed to install.
tls-extra-0.6.6 depends on crypto-numbers-0.2.3 which failed to install.
web-plugins-0.2.5 failed while unpacking the package. The exception was:
user error (data is not in tar format)
wl-pprint-text-1.1.0.2 failed while unpacking the package. The exception was:
user error (data is not in tar format)
xml-conduit-1.1.0.9 depends on xml-types-0.3.4 which failed to install.
xml-types-0.3.4 failed while unpacking the package. The exception was:
user error (data is not in tar format)
zlib-conduit-1.0.0 depends on lifted-base-0.2.2.0 which failed to install.
Same issue with a few other projects that suffered same network outage mid-install.
Loving the language so far, NOT the package management :(
Cabal sandboxes are frequently recommended for development but work well for trying out some package quickly. If anything goes wrong they are easily disposable and don't affect any other packages you have already installed. Here is what I would do to try out clckwrks-cli (BTW, if you want to just try out any package you might to choose another package with less dependencies).
$ cd /path/to/sandboxes
$ cabal get clckwrks-cli
$ cd clckwrks-cli-<version>
$ cabal sandbox init
$ cabal install --only-dependencies -j<N> # N is the number of CPU cores
At this point you can type cabal run to run the executable installed by the package (which it'll probably be at ./dist/build/bin/), cabal test for running tests, or cabal repl in order to run a ghci session with the sandboxes packages available.
If anything goes wrong you can revert back the sandbox by typing cabal sandbox delete and cabal clean. When you are done you can safely remove the sandbox without affecting other packages.
Here is what worked for me in the past
For a package $f, do
ghc-pkg.exe unregister --global --force $f
ghc-pkg.exe recache
According to its documentation, ghc-pkg.exe unregister "unregisters a package" and recache "regenerate the package database cache". --global needs to be used if the package in question was installed in system directories.
In case the database is severely damaged, I would delete the user or system cabal directory and reinstall packages that I had. I usually do this by cabal install one or several of the application libraries that I use, and let cabal reinstall the dependencies. Note: the cabal directory depends on the OS and version of GHC.
ghc-pkg unregister --force clckwrks-cli
I was having trouble with unordered-containers-0.2.5.1 and deleting the file:
~/.cabal/packages/hackage.haskell.org/unordered-containers/0.2.5.1/unordered-containers-0.2.5.1.tar.gz
fixed the problem for me. (i.e. the error cabal: data is not in tar format)
The cabal install of yesod-platform hangs downloading xss-sanitize. NetHogs shows no network activity related to this download.
$ cabal install yesod-platform
Resolving dependencies...
Downloading xss-sanitize-0.3.4...
Other packages download and install without delay.
I'm on Fedora 18. The haskell-platform and cabal-install are up-to-date from the repos.
$ cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
Edit
I left it run overnight it seemed to give up on xss-sanitizer, and continued installing the other dependencies. Here is the tail.
...
Configuring yesod-test-1.2.1...
Building yesod-test-1.2.1...
Preprocessing library yesod-test-1.2.1...
[1 of 3] Compiling Yesod.Test.CssQuery ( Yesod/Test/CssQuery.hs, dist/build/Yesod/Test/CssQuery.o )
[2 of 3] Compiling Yesod.Test.TransversingCSS ( Yesod/Test/TransversingCSS.hs, dist/build/Yesod/Test/TransversingCSS.o )
[3 of 3] Compiling Yesod.Test ( Yesod/Test.hs, dist/build/Yesod/Test.o )
Yesod/Test.hs:113:1:
Warning: In the use of `runFakeHandler'
(imported from Yesod.Core, but defined in yesod-core-1.2.4.2:Yesod.Core.Internal.Run):
"Usually you should *not* use runFakeHandler unless you really understand how it works and why you need it."
Registering yesod-test-1.2.1...
Installing library in /home/smithd/.cabal/lib/yesod-test-1.2.1/ghc-7.4.1
cabal: Error: some packages failed to install:
xss-sanitize-0.3.4 failed while downloading the package. The exception was:
<socket: 4>: hGetBufSome: timeout (Connection timed out)
yesod-1.2.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-auth-1.2.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-form-1.3.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-platform-1.2.4.2 depends on xss-sanitize-0.3.4 which failed to install.
[smithd#lin2900 ~]$ cabal install yesod-platform
My companies internet filter was blocking the haskell-xss-sanitize package as a possible XSS threat. Specifically the test modules. Have your admin white-list hackage if possible.
I generally find that cabal install's for more than half of big packages fail, rather a fatal flaw to new users!
This time I am trying to install yesod, any hints?
> cabal install yesod
...
Loading package time-1.2.0.5 ...
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
_get_current_timezone_seconds
whilst processing object file
C:\Users\guthrie\AppData\Roaming\cabal\time-1.2.0.5\ghc-7.4.1\HStime-1.2.0.5.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
cabal: Error: some packages failed to install:
authenticate-1.3.1.1 depends on http-conduit-1.6.1.1 which failed to install.
http-conduit-1.6.1.1 failed during the building phase. The exception was:
ExitFailure 1
yesod-1.1.1.2 depends on yesod-core-1.1.2.1 which failed to install.
yesod-auth-1.1.1.1 depends on yesod-core-1.1.2.1 which failed to install.
yesod-core-1.1.2.1 failed during the building phase. The exception was:
ExitFailure 1
yesod-form-1.1.3 depends on yesod-core-1.1.2.1 which failed to install.
yesod-json-1.1.0 depends on yesod-core-1.1.2.1 which failed to install.
yesod-persistent-1.1.0 depends on yesod-core-1.1.2.1 which failed to install.
yesod uses a different version of alex package than the Haskell platform. I always install alex and happy from my distro's package manager apart from ghc and then use cabal. Alternatively, you can always use
cabal update && cabal install alex happy
cabal install yesod-platform
This most likely occurs due to trying to install with two versions of the time package simultaneously. Can you try running cabal install yesod-platform and see if the problem persists?
And as #Inaimathi said, this might be due to an older version of cabal. Perhaps also try cabal update && cabal install cabal-install.