Install pip package such as backtrader in the jupyter/datascience-notebook image

you can create an environment.yml such as:

channels:
  - conda-forge
dependencies:
  - ta-lib
  - pip
  - pip:
    - backtrader
    # others

and mamba env update -p ${NB_PYTHON_PREFIX} -f environment.yml to do it all in one step. I suppose you could use shell redirection to write it directly to a file within the docker container, but just using COPY might be more maintainable.

you’ll usually benefit from sourcing as many (especially binary) dependencies as possible from mamba, which can be a bit trial-and-error.

1 Like