bbench-dep-hear / docker /Dockerfile-cuda11.2-python3.8
Archit00's picture
mirror sync @ 2026-05-27T11:20:26Z
a2143bc verified
# latest (git 'main') versions of all HEAR packages.
# ==================================================================
# module list
# ------------------------------------------------------------------
# python 3.8 (apt)
# pytorch latest (docker)
# tensorflow latest (pip)
# keras latest (pip)
# ==================================================================
FROM nvidia/cuda:11.2.0-cudnn8-devel-ubuntu18.04
ENV LANG C.UTF-8
RUN echo ''
RUN rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
apt-get update
# apt-get update && \
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
# ==================================================================
# tools
# ------------------------------------------------------------------
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
apt-utils \
ca-certificates \
wget \
git \
vim \
libssl-dev \
curl \
bc \
less \
locate \
unzip \
unrar
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && apt-get install -y -q
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ bionic main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null && \
apt-get update && \
rm /usr/share/keyrings/kitware-archive-keyring.gpg && \
$APT_INSTALL kitware-archive-keyring && \
$APT_INSTALL cmake
# ==================================================================
# python
# ------------------------------------------------------------------
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
software-properties-common \
&& \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
python3.8 \
python3.8-dev \
python3-distutils-extra \
&& \
wget -O ~/get-pip.py \
https://bootstrap.pypa.io/get-pip.py && \
python3.8 ~/get-pip.py && \
ln -s /usr/bin/python3.8 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.8 /usr/local/bin/python
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
setuptools \
pipdeptree \
&& \
$PIP_INSTALL \
numpy==1.19.2 \
scipy \
pandas \
cloudpickle \
scikit-image>=0.14.2 \
scikit-learn \
matplotlib \
Cython \
tqdm
# ==================================================================
# pytorch
# ------------------------------------------------------------------
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
future \
numpy==1.19.2 \
protobuf \
enum34 \
pyyaml \
typing \
&& \
$PIP_INSTALL \
--pre torch torchvision -f \
https://download.pytorch.org/whl/nightly/cu112/torch_nightly.html
# ==================================================================
# tensorflow
# ------------------------------------------------------------------
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
tensorflow-gpu
# Hack to get tf 2.4.2 to play nice with CUDA 11.2
# https://medium.com/mlearning-ai/tensorflow-2-4-with-cuda-11-2-gpu-training-fix-87f205215419
RUN ln -s /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcusolver.so.11 /usr/local/cuda-11.2/targets/x86_64-linux/lib/libcusolver.so.10
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/cuda-11.2/targets/x86_64-linux/lib"
# ==================================================================
# keras
# ------------------------------------------------------------------
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
h5py \
keras
# && \
# ==================================================================
# heareval
# ------------------------------------------------------------------
## workaround readline fallback
#RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && apt-get install -y -q
RUN apt update
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL software-properties-common
RUN apt update
RUN apt upgrade -y
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL sox
# h5
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL pkg-config libhdf5-100 libhdf5-dev
# LLVM >= 9.0
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL --reinstall python3-apt && \
$APT_INSTALL gpg-agent
RUN wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
# Might need to change python version: nano /usr/bin/add-apt-repository
#RUN add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
RUN add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
RUN apt update
#RUN $APT_INSTALL llvm-10 lldb-10 llvm-10-dev libllvm10 llvm-10-runtime
#RUN update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-10 10
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL llvm-11 lldb-11 llvm-11-dev libllvm11 llvm-11-runtime
RUN update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-11 11
RUN update-alternatives --config llvm-config
# For ffmpeg >= 4.2
# Could also build from source:
# https://github.com/jrottenberg/ffmpeg/blob/master/docker-images/4.3/ubuntu1804/Dockerfile
RUN add-apt-repository ppa:jonathonf/ffmpeg-4
RUN apt-get update
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL ffmpeg
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL cython ipython
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
numpy==1.19.2 \
pynvml
# gsutil
# https://cloud.google.com/storage/docs/gsutil_install#deb
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL apt-transport-https ca-certificates gnupg
RUN wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
RUN apt-get update
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL google-cloud-sdk
#gcloud init
# Install heareval pypi dependencies first, and after get the github versions,
# because this makes it faster
# to rebuild the docker if code changes but not dependencies
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL hearbaseline hearvalidator
# Touch this to force a rebuild of everything below
RUN echo 20210912
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$GIT_CLONE https://github.com/hearbenchmark/hear-baseline.git
RUN cd hear-baseline && \
python -m pip --no-cache-dir install -e ".[dev]"
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$GIT_CLONE https://github.com/hearbenchmark/hear-eval-kit.git
RUN cd hear-eval-kit && \
python -m pip --no-cache-dir install -e ".[dev]"
# THIS COMPLETE WACKNESS IS BECAUSE FUCKING dcase-util DEPENDS UPON librosa,
# which is a gnarly PITA to install and get play nice with other packages.
# I have no idea why we have numba==0.54.0
# and have to do numba==0.48 since that's in the setup.py for us
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL \
numba==0.48
# ==================================================================
# TODO Move this earlier
# ------------------------------------------------------------------
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$APT_INSTALL screen tmux
# pyenv
RUN curl https://pyenv.run | bash
# https://stackoverflow.com/a/66181816/82733
#RUN git clone --depth=1 https://github.com/pyenv/pyenv.git .pyenv
ENV HOME="/root"
ENV PYENV_ROOT="${HOME}/.pyenv"
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
RUN $PYENV_ROOT/bin/pyenv install 3.7.12
RUN $PYENV_ROOT/bin/pyenv install 3.8.12
RUN $PYENV_ROOT/bin/pyenv global system 3.7.12 3.8.12
RUN echo 'eval "$(pyenv init -)"' >> /root/.bashrc ; chmod +x /root/.bashrc
RUN echo 'eval "$(pyenv virtualenv-init -)"' >> /root/.bashrc ; chmod +x /root/.bashrc
RUN APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install" && \
GIT_CLONE="git clone --depth 10" && \
$PIP_INSTALL gdown
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
RUN \
ldconfig && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* ~/*
RUN updatedb
EXPOSE 6006