diff --git a/.circleci/config.yml b/.circleci/config.yml index d7c5ddae..1d969f69 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,17 @@ jobs: command: | apt-get update apt-get install -y openssh-client openssh-server + - run: + # Jupyter datascience notebook does not support python 2 anymore, install it manually. + # See also https://github.com/jupyter/docker-stacks/issues/432 + # Next, install python 2 kernel globally, so it can be found from the root + name: Install Python 2 Kernel + command: | + conda create -n python2 python=2 ipykernel + pip install kernda --no-cache + $CONDA_DIR/envs/python2/bin/python -m ipykernel install + kernda -o -y /usr/local/share/jupyter/kernels/python2/kernel.json + pip uninstall kernda -y - run: name: Install pyradiomics in Python 2 and 3 command: | @@ -44,6 +55,3 @@ jobs: jupyter nbconvert --ExecutePreprocessor.kernel_name=python2 --ExecutePreprocessor.timeout=-1 --to notebook --output-dir /tmp --execute notebooks/helloRadiomics.ipynb notebooks/helloFeatureClass.ipynb notebooks/PyRadiomicsExample.ipynb jupyter nbconvert --ExecutePreprocessor.kernel_name=python3 --ExecutePreprocessor.timeout=-1 --to notebook --output-dir /tmp --execute notebooks/helloRadiomics.ipynb notebooks/helloFeatureClass.ipynb notebooks/PyRadiomicsExample.ipynb - - - diff --git a/Dockerfile b/Dockerfile index df65cb4e..e0894ed2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,19 @@ LABEL org.label-schema.build-data=$BUILD_DATE \ USER root ADD . /root/pyradiomics + +# Jupyter datascience notebook does not support python 2 anymore, install it manually. +# "source activate python2 || (...)" first checks if the python 2 environment exists, +# and only installs if the environment does not exist +# See also https://github.com/jupyter/docker-stacks/issues/432 +# Next, also install python 2 kernel globally, so it can be found from the root +RUN /bin/bash -c "source activate python2 \ + || (conda create -n python2 python=2 ipykernel \ + && pip install kernda --no-cache \ + && $CONDA_DIR/envs/python2/bin/python -m ipykernel install \ + && kernda -o -y /usr/local/share/jupyter/kernels/python2/kernel.json \ + && pip uninstall kernda -y)" + # Install in Python 3 RUN /bin/bash -c "source activate root \ && cd /root/pyradiomics \