Cabal install http-conduit-browser - haskell

It's possible this is such a struggle because I'm on Windows... My latest attempt to get out of Cabal Hell, using the Git Bash:
$ rm -R ~/AppData/Roaming/ghc ~/AppData/Roaming/cabal
$ cabal update
$ cabal install cabal-install
$ cabal install http-conduit-browser
Which results in:
Failed to install http-conduit-1.9.6
Last 10 lines of the build log ( C:\Users\T\AppData\Roaming\cabal\logs\http-conduit-1.9.6.log ):
so you can specify the instance context yourself
When deriving the instance for (Read Cookie)
Network\HTTP\Conduit\Types.hs:239:19:
No instance for (Show UTCTime)
arising from the third field of `Cookie' (type `UTCTime')
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Show Cookie)
cabal.exe: Error: some packages failed to install:
http-conduit-1.9.6 failed during the building phase. The exception was:
ExitFailure 1
http-conduit-browser-1.9.0.2 depends on http-conduit-1.9.6 which failed to
install.
Attempting to just install http-conduit works fine, but I can't seem to get http-conduit-browser installed at all. If this can't work, are there any other libraries out there? I've also tried shpider but it won't work because of the curl library.

The github page for http-conduit-browser (link) recommends that you use wreq (link) instead.
If you want to use http-conduit-browser here's the trick to getting http-conduit-1.9.6 to build:
cabal get http-conduit-1.9.6
cd http-conduit-1.9.6
modify Network/HTTP/Conduit/Types.hs according to this SO answer: (link) [replace import Data.Time.Clock with import Data.Time]
cabal install
Now you should be able to build http-conduit-browser.

Related

Trouble booting Haste

I'm having trouble running haste-boot --force --local (though the same thing also happens when booting the latest cabal version with plain haste-boot). It makes some progress, then fails out with
cabal: Error: some packages failed to install:
bytestring-0.10.4.1 failed during the building phase. The exception was:
ExitFailure 1
haste-lib-0.4 depends on bytestring-0.10.4.1 which failed to install
Command '/home/inaimathi/.cabal/bin/haste-inst' failed with error code 1
I've since manually installed bytestring-0.10.4.1 with cabal install so that:
~/projects/haste-compiler $ cabal install bytestring-0.10.4.1
Resolving dependencies...
All the requested packages are already installed:
bytestring-0.10.4.1
Use --reinstall if you want to reinstall anyway.
~/projects/haste-compiler $
but the haste version still isn't cooperating.
~/projects/haste-compiler $ haste-inst install bytestring-0.10.4.1 haste-inst install bytestring-0.10.4.1
Resolving dependencies...
In order, the following will be installed:
bytestring-0.10.4.1 (reinstall) changes: base-4.6.0.1 added, deepseq-1.4.0.0
added, integer-gmp-0.5.0.0 added
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring bytestring-0.10.4.1...
Building bytestring-0.10.4.1...
Preprocessing library bytestring-0.10.4.1...
hastec: user error (Haste needs to be rebooted; please run haste-boot)
Failed to install bytestring-0.10.4.1
cabal: Error: some packages failed to install:
bytestring-0.10.4.1 failed during the building phase. The exception was:
ExitFailure 1
~/projects/haste-compiler $
Based on that error message, it looks like installing the appropriate bytestring version with haste-inst requires that I run haste-boot first, but haste-boot is failing because of an error related to installing bytestring.
Any ideas on what I can do here?
EDIT:
The relevant snippet seems to happen much earlier than the actual error in installation:
...
Data/ByteString/Internal.hs:212:10:
No instance for (Control.DeepSeq.GNFData
(GHC.Generics.Rep ByteString))
arising from a use of `Control.DeepSeq.$gdmrnf'
Possible fix:
add an instance declaration for
(Control.DeepSeq.GNFData (GHC.Generics.Rep ByteString))
In the expression: (Control.DeepSeq.$gdmrnf)
In an equation for `rnf': rnf = (Control.DeepSeq.$gdmrnf)
In the instance declaration for `NFData ByteString'
Failed to install bytestring-0.10.4.1
...
Edit 2: Jefffrey, the terminal session you requested would put this post above the 30000 character limit. Here's a pastebin link to it instead.

Cabal install reports package as installed, but Setup configure reports it as missing

I am using ghc-7.6.3 with cabal-install version 1.18.0.5 using version 1.18.1.3 of the Cabal library. My operating system is Debian Wheezy 7.5.
I have a fresh cabal install, and that I have removed the .ghc from my home directory.
After that I have changed the cabal config file and set:
remote-repo: stackage-nightly-2014-12-15:http://www.stackage.org/snapshot/nightly-2014-12-15
After that I did (following this documentation)
$ cabal update
$ cabal install alex happy yesod-bin
and the build complained that it cannot build package system-filepath-0.4.12.
So, I am trying to build package system-filepath-0.4.12 manually. After unpacking the archive, I cd-ed to the unpacked folder and entered:
$ ghc -o Setup Setup.hs
$ ./Setup configure
which gives:
Configuring system-filepath-0.4.12...
Setup: At least the following dependencies are missing:
text >=0.7.1
But
$ cabal install text
gives:
Resolving dependencies...
All the requested packages are already installed:
text-1.1.1.3
Use --reinstall if you want to reinstall anyway.
How is it possible that a package is reported as installed and missing at the same time?
Should I look for a more stable remote-repo configuration, is there something I can check that might fix the missing text package? Note that I am not using a sandbox.
EDIT
Thanks for pointing out that there are two package databases.
I have now tried both
$ cabal configure
$ cabal build
and
$ Setup configure --user
$ Setup build
Both give no error during configuration, but give the following error during the build phase:
Building system-filepath-0.4.12...
Preprocessing library system-filepath-0.4.12...
/usr/bin/ld: cannot find -lHStext-1.1.1.3-ghc7.8.3
collect2: error: ld returned 1 exit status
Try this instead
cd system-filepath--0.4.12
cabal configure
I am not sure why, but this works for me, whereas Setup.hs gave me the same error (truth be told, I always do it the cabal configure way, and am not sure if your way should also work).
There are (at least) two package databases: a global one available to all users, and a user-specific one. By default, Setup.hs looks in (and installs to) the global one, and cabal-install looks in (and installs to) the user-specific one. You can manually choose one or the other with --user and --global; so, you could fix this either by using
./Setup configure --user
or by
cabal install text --global
You can see the current state of the package databases with ghc-pkg, which will report information about both by default.

Trouble installing hstats library from hackage using cabal

When I try to install the hstats package
$ cabal install hstats
I get the following error:
src/Math/Statistics.hs:1:1:
Ambiguous module name `Prelude':
it was found in multiple packages: base haskell98-2.0.0.2
Failed to install hstats-0.3
cabal: Error: some packages failed to install:
hstats-0.3 failed during the building phase. The exception was:
ExitFailure 1
How can I fix this?
hstats depends on base >= 2.0 and haskell98. The current version of base contains the Prelude module, which was part of haskell98 at the time base was still in version 2.x, but Prelude is now part of the base package.
You need to unpack hstats and fix the error by yourself. Basically, exchange
build-depends: base>=2.0, haskell98
with
build-depends: base>=4.0
in hstats.cabal:
$ cabal unpack hstats
$ cd hstats-0.3
$ vim hstats.cabal
$ cabal install .

Failed to install ssh-0.2.12 (haskell package )

I tried to install haskell package ssh-0.2.12 with
sudo cabal install ssh-0.2.12 but it fails with
src/SSH.hs:58:114: Not in scope: type constructor or class `SHA1'
src/SSH.hs:59:115: Not in scope: type constructor or class `MD5'
Failed to install ssh-0.2.12
cabal: Error: some packages failed to install:
ssh-0.2.12 failed during the building phase. The exception was:
I am on Ubuntu 13.04.
This is because ssh just depends on cryptohash without an uppper version bound.
It was probably written against cryptohash 0.9.1, in which the MD5 constructor existed and where it is marked as deprecated, but now cryptohash 0.10.0 is out which doesn't contain it anymore.
Your cabal will install the latest versions of dependencies if there are no restrictions on them.
The right thing to do is to file a bug against the ssh package so that it gets updated. You can find a bugtracker URL on its hackage page.
Note: It is controversial whether upper version bounds are good or bad.

cabal error: Could not find module `GHC.TypeLits'. How do I fix this?

I get the following when trying to install Hlearn:
$ cabal install HLearn-distributions --ghc-options=-XConstraintKinds
Resolving dependencies...
Configuring HLearn-distributions-0.1.0.1...
Building HLearn-distributions-0.1.0.1...
Preprocessing library HLearn-distributions-0.1.0.1...
src\HLearn\Models\Distributions\Moments.hs:13:14:
Warning: -XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
src\HLearn\Models\Distributions\Moments.hs:24:8:
Could not find module `GHC.TypeLits'
Perhaps you meant GHC.Types (needs flag -package ghc-prim)
Use -v to see a list of the files searched for.
cabal.exe: Error: some packages failed to install:
HLearn-distributions-0.1.0.1 failed during the building phase. The exception
was:
ExitFailure 1
I've tried installing the package using cabal (cabal install ghc-prim) but there's no such package. Also tried
$ cabal install HLearn-distributions --ghc-options=-XConstraintKinds -f-package ghc-prim
cabal.exe: There is no package named 'ghc-prim'.
You may need to run 'cabal update' to get the latest list of available
packages.
Any suggestions?
The module GHC.TypeLits is only available from base-4.6 on, with ghc-7.6.1.
I don't see any guards around the import, so the stated constraints on base in the build-depends are wrong in the versions 0.1.0.0 and 0.1.0.1.
If you want to install that package, you have to upgrade to ghc-7.6 or install a version < 0.1,
$ cabal-install "HLearn-distributions < 0.1"

Resources