mherzl
mherzl

Reputation: 6220

"Could not resolve dependencies" with cabal due to MonadCatchIO-transformers

I am trying to build a package to deploy using propellor, and have not even been able to get it to configure due to dependency issues.

Here is the error message that I get:

$ cabal new-configure
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: prod-0.0.1 (user goal)
trying: base-4.9.1.0/installed-4.9... (dependency of prod-0.0.1)
trying: transformers-0.5.2.0/installed-0.5... (dependency of propellor-2.17.0)
next goal: MonadCatchIO-transformers (dependency of prod-0.0.1)
rejecting: MonadCatchIO-transformers-0.3.1.3 (conflict:
base==4.9.1.0/installed-4.9..., MonadCatchIO-transformers => base<4.9)
rejecting: MonadCatchIO-transformers-0.3.1.2,
MonadCatchIO-transformers-0.3.1.1, MonadCatchIO-transformers-0.3.1.0
(conflict: base==4.9.1.0/installed-4.9..., MonadCatchIO-transformers =>
base<4.8)
rejecting: MonadCatchIO-transformers-0.3.0.0,
MonadCatchIO-transformers-0.2.2.3, MonadCatchIO-transformers-0.2.2.2,
MonadCatchIO-transformers-0.2.2.1, MonadCatchIO-transformers-0.2.2.0,
MonadCatchIO-transformers-0.2.1.0, MonadCatchIO-transformers-0.2.0.0
(conflict: base==4.9.1.0/installed-4.9..., MonadCatchIO-transformers =>
base<4.7)
rejecting: MonadCatchIO-transformers-0.1.0.1 (conflict:
transformers==0.5.2.0/installed-0.5..., MonadCatchIO-transformers =>
transformers==0.1.*)
rejecting: MonadCatchIO-transformers-0.1.0.0,
MonadCatchIO-transformers-0.0.2.0, MonadCatchIO-transformers-0.0.1.0
(conflict: transformers==0.5.2.0/installed-0.5..., MonadCatchIO-transformers
=> transformers<0.2)
Dependency tree exhaustively searched.

It seems that the package 'MonadCatchIO-transformers' package requires an older version of 'base', and a much older version of transformers.

I have tried following the advice of this post (editing the configuration of MonadCatchIO-transformers and then installing) to override these requirements, but somehow get the same error message.

I have also tried many other things including this with and without sandboxes, and reinstalling my entire ghc, etc. Is there any way out of this cabal hell?

Upvotes: 1

Views: 1352

Answers (1)

duplode
duplode

Reputation: 34398

The first thing you should do when facing unsatisfiable dependencies for Hackage packages is checking the package documentation at Hackage to have a broader picture of the problem. In this case, the documentation reveals that MonadCatchIO-transformers was deprecated in favour of the exceptions package, that provides a similar interface (which explains why MonadCatchIO-transforemrs wasn't updated for base 4.9). That being so, you have basically three approaches for getting your package to build:

1. Switch your code to exceptions

Since MonadCatchIO-transformers appears to be a dependency that you are directly using in your code (as opposed to a transitive dependency), the recommended long-term solution is updating your code to use exceptions rather than MonadCatchIO-transformers.

2. Use GHC 7.10 for this project

If you can't, or don't want to, switch to exceptions right now, an alternative is setting up a parallel GHC 7.10.x installation, so that you can use base 4.8. Suggestions of ways to conveniently using cabal-install with multiple versions of GHC are presented in Using cabal with multiple GHC versions (through cabal settings -- be sure to also read the more recent answers further down the page) and in this blog post by Edsko de Vries (by managing your bash environment). Another possibility is using Stack (rather than cabal-install) to build this specific project and switching to a resolver that provides base 4.8 and MonadCatchIO-transformers (such as the LTS 6.30 Stackage snapshot), as Stack can install and manage alternative GHC versions for projects that require it (cf. the stack setup command). Stack doesn't interfere with your usual cabal-install environment or with your system-wide GHC installation; that being so, if you switch this project to Stack you can remain using cabal-install everywhere else just fine.

3. Adjust the upper bounds of MonadCatchIO-transformers

There is also approach of installing a custom version of MonadCatchIO-transformers with adjusted upper bounds of base and transformers. While that may be the quickest way to get it up and running, in this case it is also the least sustainable one, considering that MonadCatchIO-transformers has been deprecated for several years already. As for why that didn't work for you...

I have tried following the advice of this post (editing the configuration of MonadCatchIO-transformers and then installing) to override these requirements, but somehow get the same error message.

... the fact you got literally the same error message suggests that cabal-install didn't pick your custom MonadCatchIO-transformers version. Have you changed the version of MonadCatchIO-transformers, both in the .cabal file you changed (as suggested in the Q&A you linked to) and in the .cabal file of your project?

Upvotes: 2

Related Questions