populse / capsul

Collaborative Analysis Platform : Simple, Unifying, Lean
Other
7 stars 14 forks source link

Support for AFNI and ANTS in casa-distro #207

Closed LStruber closed 2 years ago

LStruber commented 2 years ago

AFNI and ANTs configuration seem to be now operational in Capsul and MIA. However, to make it works inside the bv container, there is :

  1. For AFNI, some libraries to install in the casa-distribution
  2. For ANTs, a need for a specific (old) version to install

1. AFNI I checked for the necessary dependencies to run the 3dSkullStrip brick of AFNI. Only two libraires of the long list provided by AFNI (https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_linux_ubuntu20.html#slow-setup-install-prerequisite-packages) are actually essential : libglw1-mesa and libxm4. It also seems that gsl-bin is necessary to run certain AFNI bricks. Would it be possible to add them in the next version of casa-dev.sif ?

2. ANTs I had hard times making ANTs working with casa-distro for a simple reason: the current stable version of ANTs (2.3.5) require glibc 2.28 or higher, and only glibc 2.27 and lower can be installed on Ubuntu 18.04. I have no problem running ANTs on my host Ubuntu 20.04, but when running from inside the container (ANTs still installed outside the container), it errors that glibc 2.28 is not present. Therefore, I tried to compile an older version of ANTs on my host which use glibc 2.27 but I was unable to compile the sources (for an obscure undocumented reason...). I managed to make it works by downloading an older version of ANTs (2.1.0) for which binaries (no compilation) are provided (see here for different versions: https://github.com/ANTsX/ANTs/releases). I see two solutions here:

Maybe a third solution would be to force installation of glibc 2.28 on Ubuntu 18.04 (by compiling sources https://www.linuxfromscratch.org/lfs/view/9.0-systemd/chapter05/glibc.html) but I won't go into this solution as I do not master implications on system and other softwares...

I'm not sure I put this issue in the right place. If you think it should be somewhere else, feel free to (re)move it.

denisri commented 2 years ago
  1. OK I have added the required libs in the install list, now I have to rebuild images. I'll tell you when it's done (it takes a bit of time)
  2. Actually installing another version of glibc in an Ubuntu 18 scares me a little bit, I fear we get into incompatibilities somewhere with system binaries. However I admit it's rather a fear than a real concern because I guess glibc maintains backward compatibility. But it's also a bit of work... I think a better solution would be to jump to a new container based on another system. Unfortunately Ubuntu 20.04 is not really an option: we have experienced crashes and problems with it. But we also have prepared a Ubuntu 22.04 (prerelease), with some fixes, which may be working (we still have to test it better but I thinks it works): this is casa-dev-5.3.sif: it's still hidden because still unofficial, but it's available for casa_distro pull_image. However you'd better wait until I rebuiltd it with the added dependencies for AFNI.
denisri commented 2 years ago

I have difficulties rebuilding the ubuntu 22.04 images: I have updated the ubuntu 22.04 pre-release, and there were important changes in it, like moving from python 3.9 to 3.10, in which some packages like dipy fail to install. We can hope this will be fixed, but for now it doesn't work.

denisri commented 2 years ago

pytorch is also not available for pip in python 3.10. It is however on the ubuntu repositories (apt install python3-torch), but this version doesn't seem to support cuda, contrarily to the pip versions we were using up to now. So we have to wait for these packages to be updated on pip servers.

denisri commented 2 years ago

Images 5.1 have been rebuilt and uploaded however. They are based on ubuntu 18.04 with python3 only. They should work for AFNI thus, but not for ANTs. I'm also rebuilding images 5.0 but it's not finished. The difference between 5.0 and 5.1 is that 5.0 run/user images contain only python2 and 5.1 contain only python3. 5.0 dev images contain both python2 and python3, and 5.1 dev contain only python3 (so are lighter than 5.0).

denisri commented 2 years ago

I have also published a "casa-dev-5.3alt.sif" image based on ubuntu 22.04 and python 3.10, which doesn't include dipy, and pytorch has no support for cuda. New 5.0 images have also been uploaded.

Reminder: you can get them using:

casa_distro pull_image image=casa-dev-5.3alt.sif

then either setup a new dev environment, or if you already have an existing compatible one (which will not be such for the 5.3alt image), edit the environment conf/casa_distro.json to use the image you want. If it's an update from the same version (5.0 for instance) you don't have to edit anything.

LStruber commented 2 years ago

Thank you for the new images. Just for you information, MRIQC pipeline uses bricks/functions from:

+ several others "home-made" bricks

From this and from what you wrote, it seems that we will have to wait for an update of dipy package on Ubuntu 22.04 to have a definitive version of MRIQC pipeline. In the meantime, I'll work on a version using image 5.1.sif (Ubuntu 18.04) and an old version of ANTs.

LStruber commented 2 years ago

I tried the casa-dev-5.1 container to run AFNI bricks, and it needed create the following symbolic link in the container to make it works: ln -s /usr/lib/x86_64-linux-gnu/libgsl.so.23 /usr/lib/x86_64-linux-gnu/libgsl.so.19 Would it be possible to make it before building the image ?

denisri commented 2 years ago

Well, this is a trick to fool afni into thinking it's gsl-19 whereas it is actually 23. I don't know if this can have side effects (I guess no because other software would not require gsl-19) but it's not very clean... I guess we can add it in our images but I won't rebuild the images straight now. In the meantime you can set this symlink for yourself somewhere in your LD_LIBRARY_PATH (like in /casa/host/build/lib/).

LStruber commented 2 years ago

I know that it is not very clean, but it is what AFNI recommands (https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/background_install/install_instructs/steps_linux_ubuntu20.html#slow-setup-install-prerequisite-packages) No problem not rebuilding right now ! AFNI is now working on my station with the new 5.1 container.

denisri commented 2 years ago

It's done in casa-distro sources (images have not been updated yet). But what if tomorrow another version of Afni wants to use gsl-22.9 ? We would have to bidouille the systems again and rebuild all images ? :/

LStruber commented 2 years ago

I hope that if AFNI updates to a new version, they will support the last version of gsl... I do not have an easy solution right now.

denisri commented 2 years ago

I have rebuilt and published new images, they include the symlink for libgsl-19.so.

LStruber commented 2 years ago

AFNI and ANTS are now supported in capsul and mia. I close this ticket