How to read 'opam install' satisfy errors

When I try and install several libraries at once, there is a conflict. The ocamlformat library seems to have an issue. If its just core ocamlformat it works fine. And core pgocaml pgocaml_ppx installs. But all of them together have an issue.

How do you read the output from the error? Is there a way to resolve it? Do the libraries need to be updated - and if so, how do you identify which library needs to be updated?

I’m on OCaml 4.12.

opam install core pgocaml pgocaml_ppx ocamlformat 
[NOTE] Package ocamlformat is already installed (current version is 0.18.0).
[NOTE] Package pgocaml is already installed (current version is 4.2.2).
[NOTE] Package core is already installed (current version is v0.14.1).
The following dependencies couldn't be met:
  - pgocaml_ppx → ocaml-migrate-parsetree < 2.0.0 → ocaml < 4.12
      base of this switch (use `--unlock-base' to force)
  - ocamlformat → base < v0.12 → ocaml < 4.08.0
      base of this switch (use `--unlock-base' to force)
  - ocamlformat → ocaml < 4.12
      base of this switch (use `--unlock-base' to force)
  - ocamlformat → ocaml-migrate-parsetree >= 2.1.0
  - ocamlformat → ocamlformat_support → ocaml < 4.08.0
      base of this switch (use `--unlock-base' to force)
  - ocamlformat → ppxlib >= 0.18.0 → ocaml-migrate-parsetree >= 2.1.0
  - ocamlformat → ppxlib >= 0.18.0 → ocaml < 4.12
      base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
  - No available version of ocaml-migrate-parsetree satisfies the constraints

No solution found, exiting
2 Likes

This is a somewhat opaque error message, but here’s what (I think) is going on:

Recent ocamlformat and core versions depend on “modern” Ppxlib versions that are post ocaml-migrate-parsetree 2.0, but the latest pgocaml_ppx relies on the old pre-2.0 OMP. The development version of pgocaml_ppx has used the updated toolchain for a while (see [PPX] switch to ppxlib by maxtori · Pull Request #104 · darioteixeira/pgocaml · GitHub), but this hasn’t yet been released. I’d guess your quickest fix is to pin to the development version if you’re able to (opam pin --dev pgocaml_ppx); you’ll need a more modern version if you want to run with 4.12.

To explain some of the other noise in the error message: having failed to find a (modern) released version of pgocaml_ppx that’s compatible with the other dependencies, opam seems to attempt installing a very old ocamlformat instead. It then runs into the problem that old OCamlformat versions are constrained to ocaml < 4.08.0, which isn’t compatible with your selected OCaml version.

I assume you’re using opam 2.0, and I’d be interested to know if opam 2.1 gives you a better error message here. (Although in beta still, opam 2.1 has many improvements that make it a better experience, and I highly recommend it.) It’s been a while since I’ve seen an error message this obscure.

Hope some of this helps :slightly_smiling_face:

1 Like

One way to understand the error message would be as follows:

  • At the end of the error message, the reason given for failure is:
    - No available version of ocaml-migrate-parsetree satisfies the constraints

  • If you look at the lines of the error message that contains ocaml-migrate-parsetree you get, among other things:

- pgocaml_ppx → ocaml-migrate-parsetree < 2.0.0 → ocaml < 4.12
- ocamlformat → ocaml-migrate-parsetree >= 2.1.0

(these lines explain the following chains of dependencies: pgocaml_ppx requires (as a dependency) ocaml_migrate_parsetree < 2.0.0, which itself requires ocaml < 4.12; and the second line: ocamlformat requires as dependency ocaml-migrate_parsetree >= 2.1.0)

  • These lines seem to indicate that there is an incompatibility between the verison of ocaml-migrate-parsetree required by pgocaml_ppx and ocamlformat, (and @CraigFe has detailed a bit more the reason for this incompatibility in his post, and provided the workaround most likely to work in this situation).
3 Likes

@CraigFe Thanks, that worked!

opam pin --dev pgocaml_ppx
opam install core pgocaml pgocaml_ppx ocamlformat

@zozozo Thanks for the explanation, that makes perfect sense!

1 Like

For what it’s worth, here is what opam 2.1 displays instead:

% opam install core pgocaml pgocaml_ppx ocamlformat  --show --sw 4.12.0
[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml-base-compiler >= 4.12.0 → ocaml = 4.12.0
    - ocamlformat → ocaml < 4.07.0
    You can temporarily relax the switch invariant with `--update-invariant'
  * No agreement on the version of ocaml-migrate-parsetree:
    - ocamlformat → ocaml-migrate-parsetree >= 2.1.0
    - pgocaml_ppx → ocaml-migrate-parsetree < 2.0.0

No solution found, exiting

Hopefully that would have been more helpful, we tried hard to remove the noise from these messages.

1 Like

(note that although the basic info is there, there is some inconsistency in the final version constraints: we are still working on it)

1 Like