anchor.diff:      'r-rcurl=1.95*' \
       'r-randomforest=4.6*' && conda clean -yt
   
  -# IJulia and Julia packages
  -RUN julia -e 'Pkg.add("IJulia")'
  +# Install IJulia packages 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 'Pkg.add("IJulia")' && \
  +    mv /home/$NB_USER/.local/share/jupyter/kernels/* $CONDA_DIR/share/jupyter/kernels/ && \
  +    chmod -R go+rx $CONDA_DIR/share/jupyter && \
  +    rm -rf /home/$NB_USER/.local/share
   RUN julia -e 'Pkg.add("Gadfly")' && julia -e 'Pkg.add("RDatasets")'
  +
  +USER root
  +
  +# Install Python 2 kernel spec globally to avoid permission problems when NB_UID
  +# switching at runtime.
  +RUN $CONDA_DIR/envs/python2/bin/python \
  +    $CONDA_DIR/envs/python2/bin/ipython \
  +    kernelspec install-self
positive.code:     'bokeh=0.9*' \
      pyzmq \
      && conda clean -yt
  RUN $CONDA_DIR/envs/python2/bin/python \
      $CONDA_DIR/envs/python2/bin/ipython \
      kernelspec install-self
  
  # R packages
  RUN conda config --add channels r
  RUN conda install --yes \
      'r-base=3.2*' \
  
negative.code:     julia \
      libnettle4 && apt-get clean
  
  USER jovyan
  
  # Install Python 3 packages
  RUN conda install --yes \
      'ipywidgets=4.0*' \
  