Cabal sandbox is using a global dependency. Could not resolve

266 views Asked by At

I'm trying to add timerep onto an existing application. I can't get it to resolve my dependencies. It looks like it is using the globally installed version of time == 1.4.2, when >= 1.5 would be ideal for my application.

How can I get cabal to use time 1.5? I've poked through unix, tls, process, timerep, and they all seem like they would work fine if it would just use time >= 1.5.

Here's the error:

serials> cabal install --only-dependencies
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
trying: mandrill-0.2.2.0 (dependency of serials-0.1.0.2)
trying: http-client-tls-0.2.2 (dependency of mandrill-0.2.2.0)
trying: tls-1.2.17 (dependency of http-client-tls-0.2.2)
trying: x509-validation-1.5.2 (dependency of tls-1.2.17)
trying: process-1.2.0.0/installed-487... (dependency of x509-validation-1.5.2)
next goal: unix (dependency of process-1.2.0.0/installed-487...)
rejecting: unix-2.7.0.1/installed-299... (conflict: unix =>
time==1.4.2/installed-bf9..., serials => time>=1.5)
rejecting: unix-2.7.1.0, 2.7.0.1, 2.7.0.0, 2.6.0.1, 2.6.0.0, 2.5.1.1, 2.5.1.0,
2.5.0.0, 2.4.2.0, 2.4.1.0, 2.4.0.2, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.0,
2.3.0.0, 2.2.0.0, 2.0 (conflict: process => unix==2.7.0.1/installed-299...)
Dependency tree exhaustively searched.

Cabal file:

-- Initial serials.cabal generated by cabal init.  For further
-- documentation, see http://haskell.org/cabal/users-guide/

name:                serials
version:             0.1.0.2
synopsis:            serials
description:         serials
license:             MIT
license-file:        LICENSE
author:              Sean Hess
maintainer:          Sean Hess
-- copyright:
category:            Web Scraper
build-type:          Simple
extra-source-files:  README.md
cabal-version:       >=1.10
Source-repository head
  type:       git
  location:   [email protected]:seanhess/serials.git

executable serials
  main-is:             Main.hs
  hs-source-dirs:      server
  ghc-options:         -fcontext-stack=36
  -- other-modules:
  -- other-extensions:
  default-language:     Haskell2010
  build-depends:
    base >=4.7 && <5,
    tagsoup,
    text,
    scalpel,
    containers,
    network-uri,
    monad-loops,
    wreq,
    lens,
    bytestring,
    parsec,
    utf8-string,
    tagsoup,
    xml,
    feed,
    regex-pcre,
    aeson,
    network,
    wai,
    wai-extra,
    wai-cors,
    wai-middleware-static,
    warp,
    servant-server >= 0.4,
    rethinkdb >= 1.16,
    transformers,
    either,
    unordered-containers,
    mtl,
    http-types,
    safe,
    hashable,
    resource-pool,
    time >= 1.5,
    pooled-io,
    shelly,
    string-conversions,
    bcrypt,
    random,
    jwt,
    cookie,
    entropy,
    mandrill == 0.2.2.0,
    email-validate,
    blaze-markup,
    blaze-html,
    iso8601-time,
    scotty == 0.10.0,
    timerep >= 2.0.0
1

There are 1 answers

2
kosmikus On BEST ANSWER

It is difficult for cabal-install to produce a complete description of the mutual incompatibilities of an installation problem. It instead decides to print the first path to failure.

However, it prints Dependency tree exhaustively searched. which indicates that there actually is no solution to the given problem.

One thing that often helps is to look at the choices cabal-install has made, find one that seems suboptimal, and then add an explicit constraint to change that. This may result in a better error message.

Let's try [note that I'm not sure if I have exactly the same package DB as you have, so it may produce different results on your system].

You had (modulo hashes of installed packages):

$ cabal install --only-dependencies
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
trying: mandrill-0.2.2.0 (dependency of serials-0.1.0.2)
trying: http-client-tls-0.2.2 (dependency of mandrill-0.2.2.0)
trying: tls-1.2.17 (dependency of http-client-tls-0.2.2)
trying: x509-validation-1.5.2 (dependency of tls-1.2.17)
trying: process-1.2.0.0/installed-06c... (dependency of x509-validation-1.5.2)
next goal: unix (dependency of process-1.2.0.0/installed-06c...)
rejecting: unix-2.7.0.1/installed-f86... (conflict: unix =>
time==1.4.2/installed-9b3..., serials => time>=1.5)
rejecting: unix-2.7.1.0, 2.7.0.1, 2.7.0.0, 2.6.0.1, 2.6.0.0, 2.5.1.1, 2.5.1.0,
2.5.0.0, 2.4.2.0, 2.4.1.0, 2.4.0.2, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.0,
2.3.0.0, 2.2.0.0, 2.0 (conflict: process => unix==2.7.0.1/installed-f86...)
Dependency tree exhaustively searched.

Looking through this, the error occurs with unix, which is a dependency of process. So the installed instance of process being chosen leads to trouble. So what if we disallow choosing that instance of process?

$ cabal install --only-dependencies --constraint="process source"
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: serials-0.1.0.2 (user goal)
next goal: time (dependency of serials-0.1.0.2)
rejecting: time-1.4.2/installed-9b3... (conflict: serials => time>=1.5)
trying: time-1.5.0.1
next goal: rethinkdb (dependency of serials-0.1.0.2)
rejecting: rethinkdb-1.16.0.0 (conflict: time==1.5.0.1, rethinkdb =>
time==1.4.*)
rejecting: rethinkdb-1.15.2.1, 1.15.2.0, 1.15.1.0, 1.15.0.0, 1.8.0.5, 1.8.0.4,
1.8.0.3, 1.8.0.2, 1.8.0.1, 1.8.0.0, 0.1.0.0 (conflict: serials =>
rethinkdb>=1.16)
Dependency tree exhaustively searched.

Aha! So rethinkdb, which is a direct dependency of serials, has an explicit dependency on time == 1.4.*. This is in direct conflict with the dependency of serials on time >= 1.5.

This is not easy to fix. You either need to make rethinkdb work with the newer time library, or serials with the older.

We enter the realm of speculation now: It is possible, but not guaranteed, that rethinkdb actually works with a newer version of time. We can try to instruct cabal-install to consider such install plans:

$ cabal install --only-dependencies --allow-newer=time

This actually yields an install plan on my machine. I have not tried building it, and I don't know whether it works. But it may be worth a try.