@@ -16,12 +16,18 @@ USER root
16
16
# Update OS dependencies and setup neurodebian
17
17
# ---------------------------------------------
18
18
USER root
19
- RUN ln -snf /bin/bash /bin/sh
20
- ARG DEBIAN_FRONTEND=noninteractive
21
19
RUN apt-get update && \
22
- apt-get install -yq --no-install-recommends bzip2 ca-certificates curl git tree unzip wget xvfb zip
20
+ apt-get install -yq --no-install-recommends bzip2 \
21
+ ca-certificates \
22
+ curl \
23
+ git \
24
+ tree \
25
+ unzip \
26
+ wget \
27
+ xvfb \
28
+ zip
23
29
ENV NEURODEBIAN_URL http://neuro.debian.net/lists/jessie.de-md.full
24
- RUN curl -sSL $NEURODEBIAN_URL | tee /etc/apt/sources.list.d/neurodebian.sources.list && \
30
+ RUN curl -sSL $NEURODEBIAN_URL | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list && \
25
31
apt-key adv --recv-keys --keyserver hkp://pgp.mit.edu:80 0xA5D32F012649A5A9 && \
26
32
apt-get update -qq
27
33
@@ -44,29 +50,46 @@ ENV FSLDIR=/usr/share/fsl/5.0 \
44
50
AFNI_PLUGINPATH=/usr/lib/afni/plugins \
45
51
PATH=/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH
46
52
47
- # -----------------------------------------------------
48
- # Update conda and pip dependencies (including Nipype)
49
- # -----------------------------------------------------
50
- RUN conda update conda --yes --quiet
51
- RUN conda config --add channels conda-forge
52
- RUN conda install --yes --quiet ipython \
53
- pip \
54
- jupyter \
55
- notebook \
56
- nb_conda \
57
- nb_conda_kernels \
58
- matplotlib \
59
- graphviz \
60
- pandas \
61
- seaborn \
62
- nipype
63
- RUN python -c "from matplotlib import font_manager"
53
+ # -----------------------------------------------------------------------
54
+ # Update and install conda dependencies for python2.7 (including nipype)
55
+ # -----------------------------------------------------------------------
56
+ USER $NB_USER
64
57
65
- # Clean up Python3 environment and delete not needed packages
66
- RUN conda remove --name python3 --all --yes --quiet && \
67
- conda remove qt pyqt scikit-image scikit-learn sympy --yes --quiet && \
58
+ # Make sure that necessary packages are installed
59
+ RUN conda create -yq -n python2 python=2.7 ipython \
60
+ pip \
61
+ jupyter \
62
+ notebook \
63
+ nb_conda \
64
+ nb_conda_kernels \
65
+ nilearn \
66
+ matplotlib \
67
+ graphviz \
68
+ pandas \
69
+ seaborn \
70
+ nipype && \
68
71
conda clean -tipsy
69
72
73
+ # Make sure that Python2 is loaded before Python3
74
+ ENV PATH=/opt/conda/envs/python2/bin:$PATH
75
+
76
+ # Import matplotlib the first time to build the font cache.
77
+ ENV XDG_CACHE_HOME /home/$NB_USER/.cache/
78
+ RUN MPLBACKEND=Agg $CONDA_DIR/envs/python2/bin/python -c "import matplotlib.pyplot"
79
+
80
+ # Activate ipywidgets extension in the environment that runs the notebook server
81
+ RUN jupyter nbextension enable --py widgetsnbextension --sys-prefix
82
+
83
+ # Install Python 2 kernel spec globally to avoid permission problems when NB_UID
84
+ # switching at runtime and to allow the notebook server running out of the root
85
+ # environment to find it. Also, activate the python2 environment upon kernel
86
+ # launch.
87
+ USER root
88
+ RUN pip install kernda --no-cache && \
89
+ $CONDA_DIR/envs/python2/bin/python -m ipykernel install && \
90
+ kernda -o -y /usr/local/share/jupyter/kernels/python2/kernel.json && \
91
+ pip uninstall kernda -y
92
+
70
93
# ---------------------------------------------
71
94
# Install graphviz and update pip dependencies
72
95
# ---------------------------------------------
@@ -79,10 +102,9 @@ RUN pip install --upgrade --quiet pip && \
79
102
--ignore-installed && \
80
103
rm -rf ~/.cache/pip
81
104
82
- # -----------------------------------------------------
83
- # Clear apt cache and delete unnecessary folders
84
- # -----------------------------------------------------
85
- RUN apt-get clean remove -y && \
86
- rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /boot /media /mnt /opt /srv
87
-
88
- ENV SHELL /bin/bash
105
+ # ----------------------------------------
106
+ # Clear apt cache and other empty folders
107
+ # ----------------------------------------
108
+ USER root
109
+ RUN apt-get clean && \
110
+ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /boot /media /mnt /srv
0 commit comments