haskell-numerics / random-fu

A suite of Haskell libraries for representing, manipulating, and sampling random variables
42 stars 21 forks source link

Error installing in Windows #6

Closed mcandre closed 12 years ago

mcandre commented 12 years ago

When I try to install the latest version of random-fu on Windows, Cabal reports a dependency error.

Specs:

C:\>ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.4

C:\>cabal --version
cabal-install version 0.10.2
using version 1.10.2.0 of the Cabal library

Trace:

C:\> cabal install random-fu-0.2.1.1
Registering rvar-0.2...
Configuring random-fu-0.2.1.1...
Warning: This package indirectly depends on multiple versions of the same package. This is highly likely to cause a compile failure.
package gamma-0.9.0.2 requires template-haskell-2.5.0.0
package th-extras-0.0.0.1 requires template-haskell-2.5.0.0
package random-source-0.3.0.2 requires template-haskell-2.5.0.0
package random-fu-0.2.1.1 requires template-haskell-2.5.0.0
package flexible-defaults-0.0.0.3 requires template-haskell-2.5.0.0
Preprocessing library random-fu-0.2.1.1...
Building random-fu-0.2.1.1...
<command line>: cannot satisfy -package-id random-source-0.3.0.2-3d669417cb45bca9678de9943dbdc9fe:
    random-source-0.3.0.2-3d669417cb45bca9678de9943dbdc9fe is unusable due to missing or recursive dependencies:
      flexible-defaults-0.0.0.3-22c17f0e579a7185b4c42e3b41b44483 template-haskell-2.5.0.0-87f4f416a22a910e480ac9f269479a5f th-extras-0.0.0.1-ffc8557b5d37ebd5852a23d82de5203a
    (use -v for more information)
cabal: Error: some packages failed to install:
random-fu-0.2.1.1 failed during the building phase. The exception was:
ExitFailure 1
mokus0 commented 12 years ago

I'm not able to reproduce this here. I'm running Vista 32-bit on VMWare, I did a fresh install of the Haskell platform (GHC 7.0.4, cabal-install 0.10.2, Cabal 1.10.2.0), ran "cabal update" and "cabal install random-fu" and it built version 0.2.1.1 successfully.

From your error messages it looks to me more like there are old broken packages in your ghc-pkg database. For example, where it says:

<command line>: cannot satisfy -package-id random-source-0.3.0.2-3d669417cb45bca9678de9943dbdc9fe:
    random-source-0.3.0.2-3d669417cb45bca9678de9943dbdc9fe is unusable due to missing or recursive dependencies:
      flexible-defaults-0.0.0.3-22c17f0e579a7185b4c42e3b41b44483 template-haskell-2.5.0.0-87f4f416a22a910e480ac9f269479a5f th-extras-0.0.0.1-ffc8557b5d37ebd5852a23d82de5203a

The fact that it's got an ABI hash at the end of the version number means it's trying to use a version already installed, but then it says it can't because it has missing dependencies (other packages that were already installed). This happens sometimes when you re-build existing packages. Different choices of dependencies, build flags, etc., cause the new version to have a different ABI hash, which breaks other installed packages that depend on the one that was rebuilt.

Incidentally, this is why it's generally considered a Bad Idea to use "cabal upgrade" - it rebuilds packages too eagerly and often leads to breakages exactly like this one.

I recommend running "ghc-pkg check" to see what installed packages are broken and using "ghc-pkg unregister" to remove them. If that still doesn't fix it, it might be helpful to send me the output of "ghc-pkg list" so I can see whether something else you have installed might be depending on something that conflicts with random-fu.

mcandre commented 12 years ago

On my machine, Source.DevRandom was missing, so I attempted to install random-source. That's then the problem occurred. Try cabal install random-source.

mokus0 commented 12 years ago

random-source installed fine for me as a part of the process of installing random-fu. I also had no problem re-installing it from scratch. Would you mind posting the output of "ghc-pkg check" and "cabal install -v random-fu-0.2.1.1"?

BTW, Data.Random.Source.DevRandom will always be missing on windows because on windows there's no such thing as /dev/random. If you use the MonadRandom instance for IO, it will use /dev/random on unix systems and something else on windows (currently either the mwc package or System.Random, depending on GHC version).

mcandre commented 12 years ago

BTW, Data.Random.Source.DevRandom will always be missing on windows because on windows there's no such thing as /dev/random.

Ah, I thought so. Would it be a good idea to use System.Random so that my code works on both Windows and Unix?

mokus0 commented 12 years ago

All of the other sources work on both windows and unix. If you don't have a strong preference for which algorithm to use, I would recommend just using "sample" in IO.

mokus0 commented 12 years ago

Was this issue ever resolved? If so, I'd like to close it. If not, would you mind posting the output of "ghc-pkg check" and "cabal install -v random-fu-0.2.1.1"?

Thanks!