ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.24k stars 353 forks source link

"resolution of the request timed out" even with OPAMSOLVERTIMEOUT=1200 #5504

Open MdeLv opened 1 year ago

MdeLv commented 1 year ago

I have an old ocsigen.2.19.3 configuration that I don't want&need to upgrade.

After the problem described at https://github.com/ocaml/opam/issues/5485, it was destroyed but with some tweak, I could save it with a opam switch export and built it with opam switch import.

I've the following error message with the package ocsigen-ppx-rpc requires by ocsigen-start:

$ opam install ocsigen-ppx-rpc
[ERROR] Sorry, resolution of the request timed out.                                                       
        Try to specify a more precise request, use a different solver, or increase the allowed time by    
        setting OPAMSOLVERTIMEOUT to a bigger value (currently, it is set to 60.0 seconds).               
'opam install ocsigen-ppx-rpc --verbose' failed.                                                          

Using OPAMSOLVERTIMEOUT=1200 or OPAMSOLVERTIMEOUT=1200.0 gives nothing more.

Using flag --verbose gives NO MORE details.

For unknown reason, the existing and working ocsigen-start.2.19.3 webapp was expecting ocsigen-ppx-rpc.1.0 for compilation while this package is not a dependency (it is an ocsigen-start dependecy from 4.6.0). See https://opam.ocaml.org/packages/ocsigen-ppx-rpc/ .

I suspect that it may have been caused by opam tool and opam repository that are not enough strict/demanding regarding declared opam files. ITO, one can declare a wrong opam file. See [TODO : find previous discussion about that.]

btw, what is the recommended command/way to produce the real dependencies of a package? ocamldep gives only references to external compilation units.

Possibly related issues: https://github.com/ocaml/opam/issues/3447 https://github.com/ocaml/opam/issues/4203 https://github.com/ocaml/opam/issues/3447 https://github.com/ocaml/opam/issues/685

kit-ty-kate commented 1 year ago

This is a duplicate of https://github.com/ocaml/opam/issues/5353.

I've opened https://github.com/ocaml/opam/pull/5510. With this, setting OPAMSOLVERTOLERANCE=0.0003 or above will fix your issue at hand.

MdeLv commented 1 year ago

Thanks for this useful feedback.

Side question: I'm mainly an opam-CLI user. As opam is mainly programmed in OCaml, I assume I should be able to "easily" integrate opam services in some program written in Ocaml. Apart from the API, is there a reference document to help deeply understand how to use it, be able to select a version that has been battlefield-tested on which I can also run various tests in my specific context? Thanks.

MdeLv commented 1 year ago

Hi,

opam 2.1.4

Same trouble today : impossible to install packages (after installing ocamlformat ; that fails at some step)

Using OPAMSOLVERTOLERANCE=0.0003 didn't fix the situation. Setting OPAMSOLVERTIMEOUT=600.0 either. Upgrading to opam 2.1.5 didn't fix either.

To work around, I created a new packages configuration (so-called "switch"). It's possible to install simple packages (cairo2, merlin) but not possible to install packages with more complex dependencies.

finally, I tried to pin the package to a specific version but opam still refused to install it.

My service is broken with not understandable reason. I urgently switched to another server.

Q1: how can I fix that? Can an older of opam help?

Q2: How can you make opam's behaviour more predictable?

Thanks

kit-ty-kate commented 1 year ago

opam 2.1.4 [...] Using OPAMSOLVERTOLERANCE=0.0003 didn't fix the situation.

Did you compile the branch in https://github.com/ocaml/opam/pull/5510 ? If you're still using 2.1.4 it looks like you haven't tried this fix as linked above and thus setting OPAMSOLVERTOLERANCE would have no effect as it is a new environment variable.

MdeLv commented 1 year ago

I didn't, believing it was an included var I just had to use. See

I've opened #5510. With this, setting OPAMSOLVERTOLERANCE=0.0003 or above will fix your issue at hand.

Now, when I have some trouble with opam, i don't try to fix it anymore. It's nearly always a lost of time ending with crash or pain. I start again with an export I took care to generate from a previous working configuration; or with a snapshot of the server. Hoping I won't go again in unstable parts of the sw.

PS: for unknow reason, with opam 2.1.5 I could finally build the targeted packages that failed as described.

Q2: How can you make opam's behaviour more predictable? I mean we often don't exactly know what is going on.