Tool like python poetry or elixirs mix that makes use of exhaustive lockfiles?

basically navigate to your project and type opam switch create .
This will create a local switch using the system version of ocaml.
If you’re having trouble with it, I suggest installing a fresh version of ocaml in your switch :

opam switch list-available #list  available compilers
opam switch create . 4.10.0 #install lastest version of the compiler 

Check that you’re in that switch by typing opam switch (gives you the current switch and a list of available swiches) or switch into it by typing opam switch .

Then install the libraries you want (like opam install batteries) for example