mne-bids-pipeline icon indicating copy to clipboard operation
mne-bids-pipeline copied to clipboard

Add docker file

Open abcsds opened this issue 1 year ago • 3 comments

Hi,

This is related to #591. Back I talked with @hoechenberger about parallel distributed usage of the pipeline. He mentioned there were some attempts at dask, but we concluded it might be easier to just containerize the project and run it as docker swarm.

In #591 I suggested a dockerfile from the python image, with the config file and data are the only variables of the container.

@hoechenberger suggested:

  • [X] Using the official installation of MNE:

    I changed the base image to miniconda then, to be able to install MNE through conda, as suggested in the documentation.

  • [X] Pulling the repo:

    Since dockerfiles are commonly already inside a repository, it is uncommon to pull that same repository when building the image, but I have followed your suggestion. I think it might be a good example for someone trying to build their own images.

I documented basic usage in docker/README.md, but you can test the image like this:

sudo docker build -t mne . && sudo docker run --rm -it -v /host/work:/work -v /host/data/:/data --name mne-pipeline mne

Also, I added these changes in a new folder: docker. This is because I consider these examples, rather than the one and only Dockerfile for the repo (generally stored in ./Dockerfile). One could be made with build and test targets, though: There is a tiny example comment on this Dockerfile. I don't really know how the test are run for this repo, so I didn't test it myself.

The following points are missing:

  • [ ] Changelog has been updated (docs/source/changes.md): Should I just add a new line at the top with the date and a comment on what I did?
  • [ ] Many libraries are not installed with "default" installation, as seen by the output of mne.sys_info().

Output of mne.sys_info():


Platform:         Linux-5.15.60-1-MANJARO-x86_64-with-glibc2.31
Python:           3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:35:26) [GCC 10.4.0]
Executable:       /opt/conda/envs/mnenv/bin/python
CPU:              : 12 cores
Memory:           47.0 GB

mne:              1.1.1
numpy:            1.22.4 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:            1.9.1
matplotlib:       3.5.3 {backend=agg}

sklearn:          1.1.2
numba:            0.55.2
nibabel:          4.0.2
nilearn:          0.9.2
dipy:             1.5.0
cupy:             Not found
pandas:           1.4.4
pyvista:          Not found
pyvistaqt:        Not found
ipyvtklink:       0.2.2
vtk:              Not found
qtpy:             2.2.0 {PyQt5=5.15.4}
ipympl:           Not found
pyqtgraph:        Not found
pooch:            v1.6.0

mne_bids:         Not found
mne_nirs:         Not found
mne_features:     Not found
mne_qt_browser:   0.3.2
mne_connectivity: Not found
mne_icalabel:     Not found

I think mne_bids should be installed, shouldn't it?

Best,

Alberto

abcsds avatar Sep 02 '22 19:09 abcsds

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴🏽‍♂️

welcome[bot] avatar Sep 02 '22 19:09 welcome[bot]

@abcsds since mne-bids-pipeline is becoming a package, we'll soon put it up on pip and conda, hence it will have versions you can pin, and dask now seems to be working (but not extensively tested) -- do you still want to pursue this?

larsoner avatar Oct 06 '22 19:10 larsoner

mne-bids-pipeline is becoming a package, we'll soon put it up on pip

At this point a docker container may be as simple as building off the official MNE-Docker repo build, then your image may be as simple as


FROM ghcr.io/mne-tools/mne-python-plot

RUN pip install mne-bids-pipeline

ENTRYPOINT ["tini", "-g", "--", "/usr/bin/prepare.sh"]

rob-luke avatar Oct 08 '22 04:10 rob-luke

Once we have a proper PyPI and conda-forge release, can we close this and make a PR to mne-docker to add it there? It would be nice to keep mne-installers and mne-docker in sync. Even better if mne-docker could use mne-installers to do this...

larsoner avatar Nov 19 '22 16:11 larsoner

I have been working on exactly this and will share results soon

hoechenberger avatar Nov 19 '22 17:11 hoechenberger

Closing in favor of https://github.com/mne-tools/mne-docker/issues/24 and https://github.com/mne-tools/mne-installers/issues/159

larsoner avatar Nov 30 '22 17:11 larsoner