Dockerfile 10.8 KB
Newer Older
1
FROM jupyter/tensorflow-notebook:2ce7c06a61a1
2
3
LABEL maintainer="Luca Ghiringhelli <ghiringhelli@fhi-berlin.mpg.de>"

Adam Fekete's avatar
Adam Fekete committed
4
# ================================================================================
5
# Linux applications and libraries
Adam Fekete's avatar
Adam Fekete committed
6
# ================================================================================
Adam Fekete's avatar
Adam Fekete committed
7

Luigi Sbailo's avatar
Luigi Sbailo committed
8

Adam Fekete's avatar
Adam Fekete committed
9
10
11
12
13
14
15
16
17
18
USER root
RUN apt-get update \
 && apt-get install -y -q --no-install-recommends \
        gcc \
        gfortran \
        liblapack-dev \
        libblas-dev \
        libnetcdf-dev \
        netcdf-bin \
        libxpm-dev \
19
        libgsl-dev \
Luigi Sbailo's avatar
Luigi Sbailo committed
20
        lsof \
21
        vim \
Luigi Sbailo's avatar
Luigi Sbailo committed
22
23
        git-lfs\
        openjdk-8-jdk \
Luigi Sbailo's avatar
Luigi Sbailo committed
24
25
26
27
28
29
30
31
        xvfb \
        cmake \
        mpi \
        openmpi-bin \
        openmpi-common \
        openssh-server \
        openssh-client \
        libopenmpi-dev \
Luigi Sbailo's avatar
Luigi Sbailo committed
32
        graphviz \
33
34
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*
Adam Fekete's avatar
Adam Fekete committed
35
36
USER $NB_UID

37
38
39
40
41
42
43
# Dependecies:
# - quippy: gcc gfortran liblapack-dev libblas-dev libnetcdf-dev netcdf-bin libxpm-dev libgsl-dev

# ================================================================================
# Python environment
# ================================================================================

44
45
# This part contains the installation of all the common/basic python packages.
# All the other package will be installed by the tutorial's own setup scripts.
46
47
48
# Add any additional packages you want available for use in a Python 3 notebook
# to the first line here (e.g., nglview, jupyter_contrib_nbextensions, etc.)
# https://github.com/ipython-contrib/jupyter_contrib_nbextensions
Luigi Sbailo's avatar
Luigi Sbailo committed
49

Luigi Sbailo's avatar
Luigi Sbailo committed
50
RUN pip install --upgrade pip
51
52
53
54
55
56
57
58
RUN conda install --quiet --yes \
    'pytorch::pytorch-cpu==1.1.0' \
    'pytorch::torchvision-cpu==0.3.0' \
    'nglview==2.7.0' \
    'jupyter_contrib_nbextensions==0.5.1' \
    'jupyter_nbextensions_configurator==0.4.1' \
    'ase' \
    'asap3' \
Luigi Sbailo's avatar
Luigi Sbailo committed
59
60
    'dscribe' \
    'pytest' \
Luigi Sbailo's avatar
Luigi Sbailo committed
61
    'mpi4py' \
Adam Fekete's avatar
Adam Fekete committed
62
    'orjson' \
63
    'hdbscan' \
Luigi Sbailo's avatar
Luigi Sbailo committed
64
    'pyyaml==6' \
65
    'pynndescent' \
Adam Fekete's avatar
Adam Fekete committed
66
 && conda install -c plotly plotly-orca \
67
 && conda install -c conda-forge umap-learn \
68
69
70
71
72
73
 && conda clean -tipsy \
 && jupyter nbextensions_configurator enable --user \
 && jupyter nbextension install nglview --py --sys-prefix \
 && jupyter nbextension enable nglview --py --sys-prefix \
 && jupyter nbextension enable execute_time/ExecuteTime \
 && jupyter nbextension enable init_cell/main \
Luigi Sbailo's avatar
Luigi Sbailo committed
74
 && jupyter nbextension enable collapsible_headings/main \
75
 && fix-permissions $CONDA_DIR \
Luigi Sbailo's avatar
Luigi Sbailo committed
76
 && fix-permissions /home/$NB_USER 
77

Luigi's avatar
Luigi committed
78

Luigi Sbailo's avatar
Luigi Sbailo committed
79
80
81
82
83
# Dependecies:
# - ase: many
# - nglview: many
# - asap3: grain-boundaries

Adam Fekete's avatar
Adam Fekete committed
84
85
# fixing pip installation issue of nomad-lab dependency: orjson

Luigi Sbailo's avatar
Luigi Sbailo committed
86
87
88
89
90
91
92
93
94
95
96
97
# ================================================================================
#  QMMLPACK
# ================================================================================

# for the test TMPDIR has to be defined
ENV TMPDIR "/tmp/"

WORKDIR /opt/qmmlpack
COPY 3rdparty/qmmlpack .

USER root

Adam Fekete's avatar
Adam Fekete committed
98
99
RUN ./make --debug --verbose cpp --include-path /usr/include/gsl/ --library-path /usr/lib/
RUN ./make --debug --verbose python --include-path /usr/include/gsl/ --library-path /usr/lib/
Luigi Sbailo's avatar
Luigi Sbailo committed
100
101
102
103
104
105
106
107
108
109
110
111

RUN chown -R $NB_USER:$NB_GID $PWD
USER $NB_USER


#RUN make -v install
ENV PYTHONPATH "/opt/qmmlpack/python":$PYTHONPATH

# The CML_PLUGINS environment variable tells cmlkit to register the cscribe plugin, which provides the dscribe interface.
ENV CML_PLUGINS "cscribe"
ENV CML_DATASET_PATH $HOME/tutorials/data/cmlkit/

112
113
# Dependecies:
# - ase: many
114
# - nglview: many
115
116
117
118
119
# - asap3: grain-boundaries

# ================================================================================
#  QUIP + GAP + quippy
# ================================================================================
Adam Fekete's avatar
Adam Fekete committed
120

121
122
123
124
125
126
127
128
129
130
# All the QUIPs go here; added to path in the end.
WORKDIR /opt/quip

# QUIP for general use is the OpenMP version.
ENV QUIP_ARCH linux_x86_64_gfortran_openmp
ENV QUIP_INSTALLDIR /opt/quip/bin

COPY 3rdparty/quip .
COPY 3rdparty/gap src/GAP
COPY files/Makefile.inc build/$QUIP_ARCH/
Luigi Sbailo's avatar
Luigi Sbailo committed
131
132
# COPY files/GIT_VERSION .
# COPY files/GAP_VERSION src/GAP/
133
134
135
136
137
138

USER root
RUN chown -R $NB_USER:$NB_GID $PWD
USER $NB_USER

# Installs with no suffix, e.g. quip
Adam Fekete's avatar
Adam Fekete committed
139
RUN make \
140
141
 && make install

Adam Fekete's avatar
Adam Fekete committed
142
# Installs quippy
143
RUN pip install src/f90wrap \
144
145
 && make install-quippy

Adam Fekete's avatar
Adam Fekete committed
146
147
# Make quippy executable available from terminal
ENV PATH /opt/quip/bin:$PATH
148

Luigi Sbailo's avatar
Luigi Sbailo committed
149
150
151
152
153
154
155
156
157
158
# ================================================================================
#  SISSO++
# ================================================================================

WORKDIR /opt/cpp_sisso

COPY 3rdparty/cpp_sisso .
WORKDIR /opt/cpp_sisso/build
USER root
RUN cmake -C ../cmake/toolchains/gnu_py.cmake -DEXTERNAL_BOOST=OFF ../ \
Luigi Sbailo's avatar
Luigi Sbailo committed
159
&& make install
160
161

# ================================================================================
162
#  KERAS-VIS
163
164
# ================================================================================

165
WORKDIR /opt/keras-vis
166

167
168
COPY 3rdparty/keras-vis .
RUN pip install .
Adam Fekete's avatar
Adam Fekete committed
169

Luigi Sbailo's avatar
Luigi Sbailo committed
170
# ================================================================================
171
#  ATOMIC FEATURES
Luigi Sbailo's avatar
Luigi Sbailo committed
172
173
# ================================================================================

174
WORKDIR /opt/atomic_features
Luigi Sbailo's avatar
Luigi Sbailo committed
175

176
177
178
COPY 3rdparty/atomic-features-package ./atomic-features-package
USER root
RUN pip install ./atomic-features-package
Luigi Sbailo's avatar
Luigi Sbailo committed
179

Adam Fekete's avatar
Adam Fekete committed
180
181
182
# ================================================================================
# Install all of the package dependencies of the tutorials
# ================================================================================
183

184
185
RUN conda install pynndescent

186
WORKDIR /opt/tutorials
187
COPY tutorials/ .
Adam Fekete's avatar
Adam Fekete committed
188

189
190
191
192
193
194
RUN pip install ./analytics-arise \ 
&& pip install 'git+https://github.com/AndreasLeitherer/ARISE.git'   
RUN pip install ./analytics-atomic-features
RUN pip install ./analytics-clustering-tutorial
RUN pip install ./analytics-cmlkit
RUN pip install ./analytics-co2-sgd-tutorial
195
RUN pip install ./analytics-compressed-sensing
Luigi Sbailo's avatar
Luigi Sbailo committed
196
RUN pip install ./analytics-convolutional-nn 
197
198
199
200
201
RUN pip install ./analytics-decision-tree
RUN pip install ./analytics-descriptor-role
RUN pip install ./analytics-domain-of-applicability
RUN pip install ./analytics-error-estimates
RUN pip install ./analytics-exploratory-analysis
202
203
204
RUN pip install ./analytics-gap-si-surface
RUN pip install ./analytics-grain-boundaries
RUN pip install ./analytics-kaggle-competition
Luigi Sbailo's avatar
Luigi Sbailo committed
205
RUN pip install ./analytics-krr4mat
Luigi Sbailo's avatar
Luigi Sbailo committed
206
RUN pip install ./analytics-nn-regression
Luigi Sbailo's avatar
Luigi Sbailo committed
207
RUN pip install ./analytics-perovskites-tolerance-factor
208
RUN pip install ./analytics-query-nomad-archive
Luigi Sbailo's avatar
Luigi Sbailo committed
209
RUN pip install ./analytics-sgd-alloys-oxygen-reduction-evolution
210
211
212
RUN pip install ./analytics-soap-atomic-charges
RUN pip install ./analytics-tcmi
RUN pip install ./analytics-tetradymite-PRM2020
Luigi Sbailo's avatar
Luigi Sbailo committed
213

Luigi Sbailo's avatar
Luigi Sbailo committed
214
RUN pip install nomad-lab
Luigi Sbailo's avatar
Luigi Sbailo committed
215
216
217
# Temporary fix numpy version
RUN pip install numpy==1.17

218
219
USER root

220
# Trick to stop caching
Luigi Sbailo's avatar
Luigi Sbailo committed
221
ARG CACHE_DATE=2021-1-26
222

Luigi Sbailo's avatar
Luigi Sbailo committed
223
224
225
226
227
# Create headers for all tutorials
COPY generate_headers.py .
COPY files files
RUN pip install Pillow
RUN python generate_headers.py
228

229
230
231
232
233
234
235
236
237
# Customize jupyter 
WORKDIR $HOME
COPY files/custom.css custom.css
COPY files/logo.png logo.png
COPY files/Titillium Titillium
RUN mkdir .jupyter/custom 
RUN mv custom.css .jupyter/custom \
 && mv logo.png .jupyter/custom \
 && mv Titillium .jupyter/custom
238
ARG TUTORIALS_HOME=$HOME/tutorials
Adam Fekete's avatar
Adam Fekete committed
239

Luigi Sbailo's avatar
Luigi Sbailo committed
240

241
242
243
RUN fix-permissions /opt/tutorials \
 && fix-permissions $CONDA_DIR

244
# Linking all the notebooks of the tutorials
245
WORKDIR $TUTORIALS_HOME
246
RUN ln -s /opt/tutorials/*/*.ipynb . \
Adam Fekete's avatar
Adam Fekete committed
247
 && jupyter-trust -y *.ipynb
248
249
250
251
252

# Linking images or other assets may required by the tutorials
WORKDIR $TUTORIALS_HOME/assets
RUN ln -s /opt/tutorials/*/assets/*  .

253
# Linking data may be required by the tutorials
254
255
256
WORKDIR $TUTORIALS_HOME/data
RUN mkdir data && ln -s /opt/tutorials/*/data/* .

Luigi Sbailo's avatar
Luigi Sbailo committed
257
# Testing tutorials 
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
RUN  cp -r tutorials test_tutorials
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/ARISE.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/atomic_features.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/clustering_tutorial.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/cmlkit.ipynb" 
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/CO2_SGD.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/compressed_sensing.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/convolutional_nn.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/decision_tree.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/descriptor_role.ipynb" 
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/error_estimates.ipynb" 
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/exploratory_analysis.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/gap_si_surface.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/grain_boundaries.ipynb" 
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/kaggle_competition.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/krr4mat.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/nn_regression.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/perovskites_tolerance_factor.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=5000 --to notebook --execute "test_tutorials/query_nomad_archive.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/sgd_alloys_oxygen_reduction_evolution.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/soap_atomic_charges.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/tcmi.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "test_tutorials/tetradymite_PRM2020.ipynb" 
# Remove following tutorial because test is too long
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=20000 --to notebook --execute "test_tutorials/domain_of_applicability.ipynb" 

RUN rm -r test_tutorials    
Luigi Sbailo's avatar
Luigi Sbailo committed
285

Adam Fekete's avatar
Adam Fekete committed
286
287
# ================================================================================
# Switch back to jovyan to avoid accidental container runs as root
288
289
# ================================================================================

Adam Fekete's avatar
Adam Fekete committed
290
WORKDIR $HOME
291

292
RUN fix-permissions $TUTORIALS_HOME \
293
294
295
 && fix-permissions $HOME/.local/share/jupyter \
 && fix-permissions $CONDA_DIR

296
USER $NB_UID