How to import Libraries into OCaml Jupyter?

I’m having some trouble trying to get libraries to run on the OCaml Jupyter Kernel.

I have followed all steps here.

For example, I’m trying to use the Ounit2 library.

In a Jupyter Notebook cell, after selecting the OCaml Kernel, I do

#use "topfind"
#require "ounit2"
open Ounit2

(* code using ounit2 *)

I get error ocaml jupyer kernel : unknown option '-init' and the cell keeps running until it’s stopped manually and then the notebook dies.

Note that I have not made any manual changes to the kernel generated by the ocaml-jupyter-opam-genspec in the steps above. If I remove the line containing -init from the kernel spec, I get errors on the subsequent lines (unknown option --merlin, unknown option --connection-file).

The error is reproduced in an isolated environment I run using Docker.

I’m using the library versions consistent with the required versions.