Skip to content

Commit

Permalink
Merge branch 'v1.3_cuda-10.2_ubuntu-18.04'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophSchranz committed Mar 15, 2021
2 parents f6bb51d + cb1b6f1 commit d4c7575
Show file tree
Hide file tree
Showing 5 changed files with 577 additions and 49 deletions.
153 changes: 109 additions & 44 deletions .build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,107 @@ RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \

USER $NB_UID

WORKDIR $HOME

############################################################################
################ Dependency: jupyter/datascience-notebook ##################
############################################################################

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

LABEL maintainer="Jupyter Project <[email protected]>"

# Set when building on Travis so that certain long-running build steps can
# be skipped to shorten build time.
ARG TEST_ONLY_BUILD

# Fix DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

USER root

# Julia installation
# Default values can be overridden at build time
# (ARGS are in lower case to distinguish them from ENV)
# Check https://julialang.org/downloads/
ARG julia_version="1.5.3"
# SHA256 checksum
ARG julia_checksum="f190c938dd6fed97021953240523c9db448ec0a6760b574afd4e9924ab5615f1"

# R pre-requisites
RUN apt-get update && \
apt-get install -y --no-install-recommends \
fonts-dejavu \
gfortran \
gcc && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Julia dependencies
# install Julia packages in /opt/julia instead of $HOME
ENV JULIA_DEPOT_PATH=/opt/julia \
JULIA_PKGDIR=/opt/julia \
JULIA_VERSION="${julia_version}"

WORKDIR /tmp

# hadolint ignore=SC2046
RUN mkdir "/opt/julia-${JULIA_VERSION}" && \
wget -q https://julialang-s3.julialang.org/bin/linux/x64/$(echo "${JULIA_VERSION}" | cut -d. -f 1,2)"/julia-${JULIA_VERSION}-linux-x86_64.tar.gz" && \
echo "${julia_checksum} *julia-${JULIA_VERSION}-linux-x86_64.tar.gz" | sha256sum -c - && \
tar xzf "julia-${JULIA_VERSION}-linux-x86_64.tar.gz" -C "/opt/julia-${JULIA_VERSION}" --strip-components=1 && \
rm "/tmp/julia-${JULIA_VERSION}-linux-x86_64.tar.gz"
RUN ln -fs /opt/julia-*/bin/julia /usr/local/bin/julia

# Show Julia where conda libraries are \
RUN mkdir /etc/julia && \
echo "push!(Libdl.DL_LOAD_PATH, \"$CONDA_DIR/lib\")" >> /etc/julia/juliarc.jl && \
# Create JULIA_PKGDIR \
mkdir "${JULIA_PKGDIR}" && \
chown "${NB_USER}" "${JULIA_PKGDIR}" && \
fix-permissions "${JULIA_PKGDIR}"

USER $NB_UID

# R packages including IRKernel which gets installed globally.
RUN conda install --quiet --yes \
'r-base=4.0.3' \
'r-caret=6.0*' \
'r-crayon=1.4*' \
'r-devtools=2.3*' \
'r-forecast=8.13*' \
'r-hexbin=1.28*' \
'r-htmltools=0.5*' \
'r-htmlwidgets=1.5*' \
'r-irkernel=1.1*' \
'r-nycflights13=1.0*' \
'r-randomforest=4.6*' \
'r-rcurl=1.98*' \
'r-rmarkdown=2.6*' \
'r-rsqlite=2.2*' \
'r-shiny=1.6*' \
'r-tidyverse=1.3*' \
'rpy2=3.4*' && \
conda clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Add Julia packages. Only add HDF5 if this is not a test-only build since
# it takes roughly half the entire build time of all of the images on Travis
# to add this one package and often causes Travis to timeout.
#
# Install IJulia as jovyan and then move the kernelspec out
# to the system share location. Avoids problems with runtime UID change not
# taking effect properly on the .local folder in the jovyan home dir.
RUN julia -e 'import Pkg; Pkg.update()' && \
(test $TEST_ONLY_BUILD || julia -e 'import Pkg; Pkg.add("HDF5")') && \
julia -e "using Pkg; pkg\"add IJulia\"; pkg\"precompile\"" && \
# move kernelspec out of home \
mv "${HOME}/.local/share/jupyter/kernels/julia"* "${CONDA_DIR}/share/jupyter/kernels/" && \
chmod -R go+rx "${CONDA_DIR}/share/jupyter" && \
rm -rf "${HOME}/.local" && \
fix-permissions "${JULIA_PKGDIR}" "${CONDA_DIR}/share/jupyter"

WORKDIR $HOME

############################################################################
Expand All @@ -303,13 +404,16 @@ RUN pip install --upgrade pip && \
pip install --no-cache-dir "tensorflow==2.3.2" && \
pip install --no-cache-dir keras

# Install PyTorch with dependencies
# Update cudatoolkit and install PyTorch with dependencies
RUN conda install --quiet --yes \
pyyaml mkl mkl-include setuptools cmake cffi typing
# RUN conda install --quiet --yes \
# cudatoolkit=10.1 -c pytorch

# Check compatibility here: https://pytorch.org/get-started/locally/
# Installation via conda leads to errors installing cudatoolkit=10.2
RUN pip install torch torchvision torchaudio torchviz
RUN conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch
# RUN pip install torch torchvision torchaudio torchviz

# Clean installation
RUN conda clean --all -f -y && \
Expand All @@ -325,52 +429,13 @@ RUN apt-get update && \

RUN git clone https://github.com/Syllo/nvtop.git /run/nvtop && \
mkdir -p /run/nvtop/build && cd /run/nvtop/build && \
unlink cmake .. -DNVML_RETRIEVE_HEADER_ONLINE=True || : && \
unlink make || : && unlink make install || : && \
(cmake .. -DNVML_RETRIEVE_HEADER_ONLINE=True 2> /dev/null || echo "cmake was not successful") && \
(make 2> /dev/null || echo "make was not successful") && \
(make install 2> /dev/null || echo "make install was not successful") && \
cd /tmp && rm -rf /tmp/nvtop

USER $NB_UID

############################################################################
############################ Useful packages ###############################
############################################################################

LABEL authors="Christoph Schranz <[email protected]>, Mathematical Michael <[email protected]>"

USER root

RUN pip install --no-cache-dir ipyleaflet plotly>=4.14.3 "ipywidgets>=7.5"

# Install important packages and Graphviz
RUN set -ex \
&& buildDeps=' \
graphviz==0.11 \
' \
&& apt-get update \
&& apt-get -y install htop apt-utils iputils-ping graphviz libgraphviz-dev openssh-client \
&& pip install --no-cache-dir $buildDeps

# Install various extensions
RUN fix-permissions $CONDA_DIR
# jupyterlab/github Does not support jlab 3.x yet, install well maintained alternative instead.
# RUN jupyter labextension install @jupyterlab/github
RUN pip install jupyterlab-git
RUN pip install jupyterlab-drawio
RUN jupyter nbextension enable --py --sys-prefix ipyleaflet
RUN jupyter labextension install jupyterlab-plotly
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget
# RUN pip install --no-cache-dir jupyter-tabnine --user && \
# jupyter nbextension install --py jupyter_tabnine --user && \
# jupyter nbextension enable --py jupyter_tabnine --user && \
# jupyter serverextension enable --py jupyter_tabnine --user
RUN pip install --no-cache-dir jupyter_contrib_nbextensions \
jupyter_nbextensions_configurator rise
# jupyter nbextension enable codefolding/main
RUN jupyter labextension install @ijmbarr/jupyterlab_spellchecker

RUN fix-permissions /home/$NB_USER

# Switch back to jovyan to avoid accidental container runs as root
USER $NB_UID

# Copy jupyter_notebook_config.json
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- capabilities:
- gpu
ports:
- 8849:8888
- 8848:8888
volumes:
- ./data:/home/jovyan/work
environment:
Expand Down
Loading

0 comments on commit d4c7575

Please sign in to comment.