nipy / mindboggle

Automated anatomical brain label/shape analysis software (+ website)
http://mindboggle.info
Other
146 stars 54 forks source link

use ants from neurodebian to minimize ants footprint #120

Closed satra closed 6 years ago

binarybottle commented 7 years ago

@satra -- What version of ANTs does Neurodebian use?

satra commented 7 years ago

they have the current release.

binarybottle commented 7 years ago

So in Dockerfile.mindboggle.base, I would just replace the ANTs v2.2.0 github repo installation commands with the following?:

USER root RUN apt-get update -qq && apt-get install -yq --no-install-recommends \ build-essential && \ apt-get clean && \ rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/* USER $NB_USER WORKDIR /opt RUN sudo apt-get install ants ENV ANTSPATH=/opt/ants/ \ PATH=/opt/ants:$PATH

satra commented 7 years ago
USER root
RUN apt-get update -qq && apt-get install -yq --no-install-recommends 
build-essential ants && 
apt-get clean && 
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV ANTSPATH=/usr/lib/ants/ 
PATH=$ANTSPATH:$PATH
USER $NB_USER
WORKDIR /opt

this assumes you have neurodebian setup prior to apt-get. you can check this code out: https://github.com/nipy/nipype/blob/master/docker/base.Dockerfile#L68 but make sure your version matches the mindboggle OS (the nipype container uses ubuntu xenial).

binarybottle commented 7 years ago

From the link you shared, I read the following:

COPY docker/files/neurodebian.gpg /etc/apt/neurodebian.gpg RUN curl -sSL http://neuro.debian.net/lists/xenial.us-ca.full >> /etc/apt/sources.list.d/neurodebian.sources.list && \ apt-key add /etc/apt/neurodebian.gpg && \ apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true

Where would I get the neurodebian.gpg file from? Can't I simply run?:

RUN wget -O- http://neuro.debian.net/lists/xenial.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9
satra commented 7 years ago

you can copy neurodebian.gpg from the nipype repo.

you could run that, but we have run into issues at times with the key server not responding. this was earlier this year. it's possible it has resolved. also you only need sudo if you were not running as root.

binarybottle commented 7 years ago

I ran the following:

USER root WORKDIR /opt RUN curl -sSL https://raw.githubusercontent.com/nipy/nipype/master/docker/files/neurodebian.gpg > /etc/apt/neurodebian.gpg && \ curl -sSL http://neuro.debian.net/lists/xenial.us-ca.full >> /etc/apt/sources.list.d/neurodebian.sources.list && \ apt-key add /etc/apt/neurodebian.gpg && \ apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true

RUN apt-get update -qq && apt-get install -yq --no-install-recommends build-essential ants && \ apt-get clean && \ rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/* ENV ANTSPATH=/usr/lib/ants/ ENV PATH=$ANTSPATH:$PATH USER $NB_USER

and got an error:

The following packages have unmet dependencies: ants : Depends: libinsighttoolkit4.9 but it is not installable Depends: libstdc++6 (>= 5.2) but 4.9.2-10 is to be installed E: Unable to correct problems, you have held broken packages. The command '/bin/sh -c apt-get update -qq && apt-get install -yq --no-install-recommends build-essential ants && apt-get clean && rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/*' returned a non-zero code: 100

binarybottle commented 7 years ago

I'm going to go ahead and create a new minor release with the --fs_flags argument and deal with this ants footprint issue later...

satra commented 7 years ago

@binarybottle - you should perhaps use neurodocker to build the dockerfile for mindboggle now. at present i think it supports all pieces that you will need. here is a close enough example:

docker run --rm kaczmarj/neurodocker generate -b neurodebian:stretch-non-free -p apt \
--freesurfer version=6.0.0 min=True \
--install convert3d ants fsl graphviz tree git-annex-standalone vim emacs-nox nano less ncdu tig git-annex-remote-rclone \
--user=neuro \
--miniconda python_version=3.6 \
            conda_install="jupyter jupyterlab traits pandas matplotlib reprozip reprounzip" \
            env_name="neuro" \
            pip_install="https://github.com/nipy/nipype/tarball/master  https://github.com/INCF/pybids/archive/master.zip datalad duecredit" \
--workdir /home/neuro \
--no-check-urls > Dockerfile
satra commented 7 years ago

there are a few tweaks that this will require, but it is a much simpler way of generating the Dockerfile environment. @kaczmarj or i can help you with those tweaks.

binarybottle commented 7 years ago

I'm happy to use neurodocker if it makes the process easier, but at least I have a handle on building the Docker containers now (except for the neurodebian ants piece). I'm not sure how I would use neurodocker to inherit from Dockerfile.mindboggle.base to create Dockerfile.mindboggle.complete.

satra commented 7 years ago

@binarybottle - you wouldn't use base or complete. just augment the command to install all the necessary dependencies.

kaczmarj commented 7 years ago

@binarybottle - here's a neurodocker command that should replicate mindboggle's base dockerfile. i set some things as shell variables to try to improve readability, but they could have been included directly in the neurodocker command. notice that the command to download the oasis template data has to be written in manually.

the complete dockerfile will be tricker. you could write out the commands to install mindboggle and roygbiv and include them with the --instruction tag, but what do you think about updating mindboggle's setup.py file to compile vtk_cpp_tools automatically? then https://github.com/nipy/mindboggle/tarball/master could be added to the list of packages to pip install. something similar might be done with roygbiv (ie update the submodules automatically).

SYSTEM_INSTALL="ants build-essential emacs-nox git graphviz less
                libsm-dev libx11-dev libxt-dev libxext-dev
                tree vim wget xvfb zip"
CONDA_INSTALL="cmake matplotlib nomkl pandas pip pythreejs
               scipy vtk=7.1.1 xvfbwrapper"
PIP_INSTALL="pip reprozip reprounzip
             https://github.com/nipy/nibabel/tarball/ca977abeb77f95ed3a40b7b89c310b286b9885b7
             https://github.com/nipy/nipype/tarball/master
             scipy cmake pythreejs xvfbwrapper"
OASIS_CMD="RUN curl -sSL -o templates.zip https://osf.io/rh9km/?action=download\&version=2 \\
           && unzip templates.zip \\
           && rm -f templates.zip"

docker run --rm kaczmarj/neurodocker generate -b neurodebian:stretch-non-free -p apt \
--install "$SYSTEM_INSTALL" \
--user neuro \
--miniconda python_version=3.6 \
            env_name="neuro" \
            conda_install="$CONDA_INSTALL" \
            pip_install="$PIP_INSTALL" \
--user root \
--freesurfer version=6.0.0 min=true \
--instruction "$OASIS_CMD" \
--workdir /home/neuro \
--user neuro

edit: added slashes in OASIS_CMD edit2: remove nomkl from PIP_INSTALL edit3: added slash before & in oasis data url edit4: remove reprozip and reprounzip from conda install

satra commented 7 years ago

@kaczmarj - this will require one more step to compile the cpp routines and export the appropriate path through an environment variable.

satra commented 7 years ago

@kaczmarj - sorry i didn't read your second paragraph. if the installation can be done through setup.py and pip that would be interesting, but compiling things is always interesting in python land.

binarybottle commented 6 years ago

Thank you, @satra !

--ants version=b43df4bfc8 method=source cmake_opts='-DBUILD_SHARED_LIBS=ON' make_opts='-j 4' https://github.com/nipy/mindboggle/blob/master/install/neurodocker.sh#L54