Ocaml Jupyter Does NOT Detect Installed Packages

Installed packaged are not listed when running #list inside jupyter notebook. However, in utop, you can see the packages when running the same command (#list ) . Perhaps Jupyter is not exposed to packages when installed under opam install ... .

How can I get Jupyter to detect packages installed through opam install ... ? Please advise.

It seems the best approach may be to use docker container with Ocaml and Jupyter. Many ocaml/jupyter containers available on github were outdated so I have modified a dockerfile to build an updated version of the container. The dockerfile is posted below for anyone interested.

FROM ocaml/opam:alpine-ocaml-4.11-afl

ENV PATH $PATH:/home/opam/.local/bin

RUN sudo apk add --upgrade --no-cache zlib gmp zeromq python3 && \
    sudo apk add --upgrade --no-cache \
                 --virtual=.build-dependencies \
                 curl m4 perl zlib-dev gmp-dev zeromq-dev libffi-dev python3-dev && \
    sudo apk add cmd:pip3 && \
    sudo pip3 install --upgrade pip && \
     pip3 install --user --no-cache-dir 'setuptools>=18.5' 'six>=1.9.0' jupyterlab && \
        mkdir -p /home/opam/.jupyter

ENV PATH $PATH:/home/opam/.local/bin
RUN opam user-setup install && opam install -y jupyter && opam exec -- ocaml-jupyter-opam-genspec
RUN jupyter kernelspec install --name ocaml-jupyter "$(opam config var share)/jupyter" --user

CMD [ "jupyter", "lab", "--no-browser", "--ip=*" ]