Dockerfile 11.2 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

50
RUN conda install conda=4.11
Luigi Sbailo's avatar
Luigi Sbailo committed
51
RUN pip install --upgrade pip
52
53
54
55
56
57
58
59
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
60
61
    'dscribe' \
    'pytest' \
Luigi Sbailo's avatar
Luigi Sbailo committed
62
    'mpi4py' \
Adam Fekete's avatar
Adam Fekete committed
63
    'orjson' \
64
    'hdbscan' \
Luigi Sbailo's avatar
Luigi Sbailo committed
65
    'pyyaml==6' \
66
67
68
69
70
    'numba==0.52' \
    'scikit-learn==0.24' \
    'pandas==1.2.5'\
    'urllib3==1.26.5'\
    'nest-asyncio '\
Adam Fekete's avatar
Adam Fekete committed
71
 && conda install -c plotly plotly-orca \
72
 && conda install -c conda-forge umap-learn \
73
74
75
76
77
78
 && 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
79
 && jupyter nbextension enable collapsible_headings/main \
80
 && fix-permissions $CONDA_DIR \
Luigi Sbailo's avatar
Luigi Sbailo committed
81
 && fix-permissions /home/$NB_USER 
82
83
RUN pip install nomad-lab --extra-index-url https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple

84

Luigi's avatar
Luigi committed
85

Luigi Sbailo's avatar
Luigi Sbailo committed
86
87
88
89
90
# Dependecies:
# - ase: many
# - nglview: many
# - asap3: grain-boundaries

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

Luigi Sbailo's avatar
Luigi Sbailo committed
93
94
95
96
97
98
99
100
101
102
103
104
# ================================================================================
#  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
105
106
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
107
108
109
110
111
112
113
114
115
116
117
118

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/

119
120
# Dependecies:
# - ase: many
121
# - nglview: many
122
123
124
125
126
# - asap3: grain-boundaries

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

128
129
130
131
132
133
134
135
136
137
# 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
138
139
# COPY files/GIT_VERSION .
# COPY files/GAP_VERSION src/GAP/
140
141
142
143
144
145

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
146
RUN make \
147
148
 && make install

Adam Fekete's avatar
Adam Fekete committed
149
# Installs quippy
150
RUN pip install src/f90wrap \
151
152
 && make install-quippy

Adam Fekete's avatar
Adam Fekete committed
153
154
# Make quippy executable available from terminal
ENV PATH /opt/quip/bin:$PATH
155

Luigi Sbailo's avatar
Luigi Sbailo committed
156
157
158
159
160
161
162
163
164
165
# ================================================================================
#  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
166
&& make install
167
168

# ================================================================================
169
#  KERAS-VIS
170
171
# ================================================================================

172
WORKDIR /opt/keras-vis
173

174
175
COPY 3rdparty/keras-vis .
RUN pip install .
Adam Fekete's avatar
Adam Fekete committed
176

Luigi Sbailo's avatar
Luigi Sbailo committed
177
# ================================================================================
178
#  ATOMIC FEATURES
Luigi Sbailo's avatar
Luigi Sbailo committed
179
180
# ================================================================================

181
WORKDIR /opt/atomic_features
Luigi Sbailo's avatar
Luigi Sbailo committed
182

183
184
185
COPY 3rdparty/atomic-features-package ./atomic-features-package
USER root
RUN pip install ./atomic-features-package
Luigi Sbailo's avatar
Luigi Sbailo committed
186

Luigi Sbailo's avatar
Luigi Sbailo committed
187
188
189
190
191
192
193
194
195
196
# ================================================================================
#  CMLKIT
# ================================================================================

WORKDIR /opt/cmlkit

COPY 3rdparty/cmlkit ./cmlkit
USER root
RUN pip install ./cmlkit

Adam Fekete's avatar
Adam Fekete committed
197
198
199
# ================================================================================
# Install all of the package dependencies of the tutorials
# ================================================================================
200

201
202
RUN conda install pynndescent

203
WORKDIR /opt/tutorials
204
COPY tutorials/ .
Adam Fekete's avatar
Adam Fekete committed
205

206
207
208
209
210
211
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
212
RUN pip install ./analytics-compressed-sensing
Luigi Sbailo's avatar
Luigi Sbailo committed
213
RUN pip install ./analytics-convolutional-nn 
214
215
216
RUN pip install ./analytics-decision-tree
RUN pip install ./analytics-descriptor-role
RUN pip install ./analytics-domain-of-applicability
217
RUN pip install ./analytics-dos-similarity-search
218
219
RUN pip install ./analytics-error-estimates
RUN pip install ./analytics-exploratory-analysis
220
221
222
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
223
RUN pip install ./analytics-krr4mat
Luigi Sbailo's avatar
Luigi Sbailo committed
224
RUN pip install ./analytics-nn-regression
Luigi Sbailo's avatar
Luigi Sbailo committed
225
RUN pip install ./analytics-perovskites-tolerance-factor
226
RUN pip install ./analytics-query-nomad-archive
Luigi Sbailo's avatar
Luigi Sbailo committed
227
RUN pip install ./analytics-sgd-alloys-oxygen-reduction-evolution
228
RUN pip install ./analytics-sgd-propylene-oxidation-hte
229
230
231
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
232

233
234
USER root

235
# Trick to stop caching
Luigi Sbailo's avatar
Luigi Sbailo committed
236
ARG CACHE_DATE=2021-1-26
237

Luigi Sbailo's avatar
Luigi Sbailo committed
238
239
240
241
242
# Create headers for all tutorials
COPY generate_headers.py .
COPY files files
RUN pip install Pillow
RUN python generate_headers.py
243

244
245
246
247
248
249
250
251
252
# 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
253
ARG TUTORIALS_HOME=$HOME/tutorials
Adam Fekete's avatar
Adam Fekete committed
254

Luigi Sbailo's avatar
Luigi Sbailo committed
255

256
257
258
RUN fix-permissions /opt/tutorials \
 && fix-permissions $CONDA_DIR

259
# Copy all the notebooks of the tutorials
260
WORKDIR $TUTORIALS_HOME
261
RUN cp /opt/tutorials/*/*.ipynb . \
Adam Fekete's avatar
Adam Fekete committed
262
 && jupyter-trust -y *.ipynb
263

264
# Copy images or other assets may required by the tutorials
265
WORKDIR $TUTORIALS_HOME/assets
266
RUN cp -r /opt/tutorials/*/assets/*  .
267

268
# Copy data may be required by the tutorials
269
WORKDIR $TUTORIALS_HOME/data
270
RUN cp -r /opt/tutorials/*/data/* .
271

Luigi Sbailo's avatar
Luigi Sbailo committed
272
273
WORKDIR $HOME

Luigi Sbailo's avatar
Luigi Sbailo committed
274
# Testing tutorials 
275
RUN  cp -r tutorials test_tutorials
Luigi Sbailo's avatar
Luigi Sbailo committed
276
277

WORKDIR $HOME/test_tutorials
278
279
280
281
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "ARISE.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "atomic_features.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "clustering_tutorial.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "cmlkit.ipynb" 
Luigi Sbailo's avatar
Luigi Sbailo committed
282
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "CO2_SGD.ipynb" 
283
284
285
286
287
288
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "compressed_sensing.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "convolutional_nn.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "decision_tree.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "descriptor_role.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=20000 --to notebook --execute "domain_of_applicability.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "dos_similarity_search.ipynb" 
289
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "error_estimates.ipynb" 
290
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "exploratory_analysis.ipynb" 
Luigi Sbailo's avatar
Luigi Sbailo committed
291
292
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "gap_si_surface.ipynb"
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "grain_boundaries.ipynb" 
293
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "kaggle_competition.ipynb" 
294
295
296
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "krr4mat.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "nn_regression.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "perovskites_tolerance_factor.ipynb" 
297
RUN jupyter nbconvert --ExecutePreprocessor.timeout=5000 --to notebook --execute "query_nomad_archive.ipynb" 
298
299
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "sgd_alloys_oxygen_reduction_evolution.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "sgd_propylene_oxidation_hte.ipynb" 
Luigi Sbailo's avatar
Luigi Sbailo committed
300
# RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "soap_atomic_charges.ipynb" 
301
302
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "tcmi.ipynb" 
RUN jupyter nbconvert --ExecutePreprocessor.timeout=1000 --to notebook --execute "tetradymite_PRM2020.ipynb" 
303

Adam Fekete's avatar
Adam Fekete committed
304
WORKDIR $HOME
Luigi Sbailo's avatar
Luigi Sbailo committed
305
RUN rm -r test_tutorials    
306

Luigi Sbailo's avatar
Luigi Sbailo committed
307
# Fix permissions 
308
RUN fix-permissions $TUTORIALS_HOME \
309
310
311
 && fix-permissions $HOME/.local/share/jupyter \
 && fix-permissions $CONDA_DIR

Luigi Sbailo's avatar
Luigi Sbailo committed
312
313
314
315
316

# ================================================================================
# Switch back to jovyan to avoid accidental container runs as root
# ================================================================================

317
USER $NB_UID