opam icon indicating copy to clipboard operation
opam copied to clipboard

Confusing behavior with installed but now-unavailable package

Open sim642 opened this issue 1 year ago • 0 comments

At some point I created an opam switch with ocaml-variants.4.14.2+trunk as the invariant (probably by accident, but it wasn't an issue so far). I now needed to install a newly released package from opam repository so I did opam update. This also included the update that ocaml-variants.4.14.2+trunk is now unavailable.

The result of this was that opam seemed to refuse to do anything because the unavailable package was still installed in my switch. For example, when I just tried installing the unrelated new package with opam install, then it just complained about ocaml-variants.4.14.2+trunk as "missing dependency" or something. opam upgrade had the same problem. Even opam remove ocaml-variants.4.14.2+trunk errored like that, which was particularly confusing (the unavailable package is a problem, but I also cannot get rid of it).

I think eventually opam install --update-invariant ocaml-variants.4.14.2+options or something actually worked to make the switch usable again. However, I don't remember seeing --update-invariant being suggested by any of the earlier errors (I don't have the output logs).

It seems that an installed but now-unavailable package is somehow problematic for opam. Although I think it shouldn't have been in my case, especially because the package version still exists on opam-repository (albeit with different contents). Nevertheless, if a package is already installed and there's no need to change it, then being unavailable shouldn't be a problem for existing installations.

opam config (after fixing the switch)

# opam config report
# opam-version         2.2.0~alpha~dev (061d7305ce1f555c6ead0c81c5d8874504426b39) 
# self-upgrade         no
# system               arch=x86_64 os=linux os-distribution=ubuntu os-version=22.04
# solver               builtin-mccs+glpk
# install-criteria     -removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed
# upgrade-criteria     -removed,-count[avoid-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new
# jobs                 15
# repositories         1 (version-controlled)
# pinned               2 (git), 1 (rsync)
# current-switch       /mnt/goblint-svcomp/sv-comp/goblint
# ocaml:native         true
# ocaml:native-tools   true
# ocaml:native-dynlink true
# ocaml:stubsdir       /mnt/goblint-svcomp/sv-comp/goblint/_opam/lib/ocaml/stublibs:/mnt/goblint-svcomp/sv-comp/goblint/_opam/lib/ocaml
# ocaml:preinstalled   false
# ocaml:compiler       4.14.2+options+flambda+nnp

sim642 avatar Apr 23 '24 18:04 sim642