6

I'm trying to build the Elm Platform using a cabal sandbox. The installation fails however with the message "packages are likely to be broken by the reinstalls". This seems to me to contradict the whole purpose of sandboxing, which I had believed was supposed to avoid this kind of error.

Can anybody explain this error for me, and even better help me proceed with the Elm install? Is it safe to add --force-reinstalls?

Here are the sequence of commands I executed:

cabal sandbox init
cabal update
cabal install -j elm-compiler-0.14 elm-package-0.2 elm-make-0.1 elm-reactor-0.2 elm-repl-0.4

I'm using cabal 1.22.0.0 and GHC 7.8.2 on Mac OS 10.10. The full output as follows:

Resolving dependencies...
In order, the following would be installed:
Diff-0.3.0 (new package)
HUnit-1.2.5.2 (new package)
ansi-terminal-0.6.2.1 (new package)
ansi-wl-pprint-0.6.7.1 (new package)
async-2.0.2 (new package)
blaze-markup-0.6.2.0 (new package)
blaze-html-0.7.0.3 (new package)
byteable-0.1.1 (new package)
bytestring-mmap-0.2.2 (new package)
bytestring-trie-0.2.4 (new package)
cereal-0.4.1.1 (new package)
cmdargs-0.10.12 (new package)
concatenative-1.0.1 (new package)
cookie-0.4.1.4 (new package)
cryptohash-0.11.6 (new package)
enumerator-0.4.20 (new package)
attoparsec-enumerator-0.3.3 (new package)
blaze-builder-enumerator-0.2.0.6 (new package)
exceptions-0.6.1 (reinstall) changes: mtl-2.1.3.1 -> 2.2.1,
transformers-0.3.0.0 -> 0.4.1.0
extensible-exceptions-0.1.1.4 (new package)
hfsevents-0.1.5 (new package)
fsnotify-0.1.0.3 (new package)
hourglass-0.2.8 (new package)
asn1-types-0.3.0 (new package)
asn1-encoding-0.9.0 (new package)
asn1-parse-0.9.0 (new package)
crypto-pubkey-types-0.4.2.3 (new package)
http-types-0.8.5 (new package)
mime-types-0.1.0.5 (new package)
monads-tf-0.1.0.2 (reinstall) changes: transformers-0.3.0.0 -> 0.4.1.0
MonadCatchIO-transformers-0.3.1.3 (new package)
network-2.6.0.2 (new version)
parsec-3.1.7 (new version)
indents-0.3.3 (new package)
network-uri-2.6.0.1 (new package)
HTTP-4000.2.19 (new version)
pem-0.2.2 (new package)
prettyclass-1.0.0.0 (new package)
language-glsl-0.1.1 (new package)
publicsuffixlist-0.1 (new package)
regex-base-0.93.2 (new package)
regex-posix-0.95.2 (new package)
securemem-0.1.4 (new package)
crypto-cipher-types-0.0.9 (new package)
cipher-aes-0.2.9 (new package)
cipher-des-0.0.6 (new package)
cipher-rc4-0.1.4 (new package)
crypto-random-0.0.8 (new package)
cprng-aes-0.6.1 (new package)
crypto-numbers-0.2.7 (new package)
crypto-pubkey-0.2.7 (new package)
socks-0.5.4 (new package)
streaming-commons-0.1.8 (new package)
http-client-0.3.8.2 (latest: 0.4.6.2) (new package)
syb-0.4.4 (new package)
tagshare-0.0 (new package)
terminfo-0.4.0.0 (new package)
haskeline-0.7.1.3 (new package)
tf-random-0.5 (new package)
QuickCheck-2.7.6 (new package)
testing-feat-0.4.0.2 (new package)
transformers-compat-0.3.3.4 (new package)
optparse-applicative-0.10.0 (latest: 0.11.0.1) (new package)
union-find-0.2 (new package)
unix-compat-0.4.1.4 (new package)
unordered-containers-0.2.5.1 (new package)
aeson-0.8.0.2 +old-locale (new package)
aeson-pretty-0.7.2 (new package)
uniplate-1.6.12 (new package)
websockets-0.9.2.2 (new version)
wl-pprint-1.1 (new package)
language-ecmascript-0.16.2 (latest: 0.17) (new package)
elm-compiler-0.14 (new package)
x509-1.5.0.1 (new package)
x509-store-1.5.0 (new package)
x509-system-1.5.0 (new package)
x509-validation-1.5.1 (new package)
tls-1.2.13 (new package)
connection-0.2.3 (new package)
http-client-tls-0.2.2 (new package)
zip-archive-0.2.3.5 (new version)
elm-package-0.2 (latest: 0.2.2) (new package)
elm-make-0.1 (new package)
elm-repl-0.4 (new package)
zlib-enum-0.2.3.1 (new package)
snap-core-0.9.6.4 (new package)
snap-server-0.9.4.6 (new package)
websockets-snap-0.9.0.0 (new package)
elm-reactor-0.2 (latest: 0.2.0.1) (new package)
cabal: The following packages are likely to be broken by the reinstalls:
temporary-1.2.0.3
shellmate-0.1.6
Use --force-reinstalls if you want to install anyway.

UPDATE:

As requested, the output from cabal exec ghc-pkg list temporary:

$ cabal exec ghc-pkg list temporary
/Applications/ghc-7.8.2.app/Contents/lib/ghc-7.8.2/package.conf.d
   temporary-1.2.0.3
/Users/nbartlett/Development/Elm-Platform/tmp/.cabal-sandbox/x86_64-osx-ghc-7.8.2-packages.conf.d
Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • A) check your global ghc-pkg cache. B) might just be that you're installing a broken combination, or a broken combination is required. Consider using Stackage. – Bartek Banachewicz Jan 08 '15 at 11:46
  • I believe it is safe to use --force-reinstalls with sandboxing. In any event no packages in the global or user area will be affected. – ErikR Jan 08 '15 at 11:47
  • Also see the comment by @kosmikus here: http://stackoverflow.com/a/19693975/866915 – ErikR Jan 08 '15 at 13:14
  • You can also try if `--constraint="mtl == 2.1.3.1" --constraint="transformers == 0.3.0.0" leads to a better install plan. If not: if `temporary` and `shellmate` don't live in the sandbox, you're fine anyway. If they do, you might need to reinstall them after that (or accept they're broken). – kosmikus Jan 08 '15 at 13:24
  • What does `cabal exec ghc-pkg list temporary` say? What about for `shellmate`? The usual solution for broken reinstalls is to add them to the installation; e.g. `cabal install elm temporary shellmate`; let us know what that does, too. – Daniel Wagner Jan 08 '15 at 20:56

2 Answers2

5

You have installed shellmate and temporary (and potentially a few other packages -- especially dependencies of these) into your global package database, which is also visible from within sandboxes. The error is saying that:

  1. You are about to install a new version (call it A-2) of a package that's already installed (call the existing one A-1), and
  2. you are about to reinstall an existing version (call it B) of a package that updates one of its dependencies from A-1 to A-2, and
  3. the new B will shadow the old B, and
  4. there is a package (call it C) which depends on B.

The upshot of all this is that C will probably be broken after the reinstallation of B, since it will link to B expecting this to drag in A-1, but A-2 will be drug in instead. In your particular case, both shellmate and temporary are playing the role of C, and for each of them at least one of exceptions-0.6.1 or monads-tf-0.1.0.2 is playing the role of B.

You have many choices; the most attractive to me are:

  1. Remove shellmate and temporary from your global package database. These will no longer be available, but this way is certain to prevent a lot of problems.

    ghc-pkg unregister --global shellmate
    ghc-pkg unregister --global temporary
    
  2. Reinstall shellmate and temporary in your global package database with updated dependencies. This may or may not work.

    cabal install --reinstall --global shellmate-0.1.6 temporary-1.2.0.3 mtl-2.2.1 transformers-0.4.1.0
    
  3. Ignore the warnings and force reinstalls. It is likely that shellmate and temporary will be unusable from within the sandbox.

    cabal install elm --force-reinstalls # from within the sandbox
    
  4. Install elm, shellmate, and temporary all into the sandbox. It is possible that this will still give you warnings, but they may safely be ignored: within the sandbox, you expect to use the sandbox versions (hence the "broken" global packages won't matter), and outside the sandbox the global packages will not be broken.

    cabal install elm temporary shellmate # possibly with --force-reinstalls
    
Daniel Wagner
  • 145,880
  • 9
  • 220
  • 380
  • But what to do if the problem packages are… `ghc` and `cabal` itself! The `cabal install --reinstall --global ghc-7.10.1` in this case reports `cabal: There is no package named 'ghc'`. – Hi-Angel Oct 31 '15 at 13:14
  • 1
    @Hi-Angel There are a few packages you should not upgrade, including `base` and `ghc`. They're just too tied to the compiler. For those packages, the only way to get the right version is to get the appropriate compiler version (i.e. upgrade or downgrade GHC itself). – Daniel Wagner Oct 31 '15 at 17:26
1

I had what looks like the same problem while trying to install multiple packages at the same time. One package A depended on package B and A and B depended on different versions of package C. (That is my mental model of the situation anyway).

My particular installation blockage was cleared [*] by installing the packages separately instead of all at once. Instead of one command with N packages, I had N commands with one package at a time.

[*] Since I am not certain about the cause of my problem, I can also not be certain about exactly what resolved it.

neniu
  • 419
  • 3
  • 8