-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AFNI recipe does not work correctly in Singularity build #585
Comments
it seems that in Singularity, the environment variables made in i tested this using a small Singularity file # Test whether updated environment variables like PATH are available in %post.
Bootstrap: docker
From: fedora:36
%environment
export PATH="/opt/afni-latest:$PATH"
export NEWVAR="ThisIsATest"
%post
echo $PATH
echo $NEWVAR and during the build, I get the following output, which shows that the updated
for help in debugging, here are the Dockerfile and Singularity file for the command
Dockerfile# Generated by Neurodocker and Reproenv.
FROM fedora:36
ENV PATH="/opt/afni-latest:$PATH" \
AFNI_PLUGINPATH="/opt/afni-latest"
RUN yum install -y -q \
R \
cmake \
curl \
ed \
gsl \
libGLU \
libXp \
libXpm \
libcurl-devel \
libgomp \
libjpeg-turbo-devel \
libpng12 \
mesa-dri-drivers \
mesa-dri-drivers \
mesa-libGLw \
ncurses-compat-libs \
netpbm-progs \
openmotif \
openssl-devel \
python-is-python3 \
python3-pip \
tcsh \
udunits2-devel \
unzip \
wget \
which \
which \
xorg-x11-fonts-misc \
xorg-x11-server-Xvfb \
&& yum clean all \
&& rm -rf /var/cache/yum/* \
&& gsl_path="$(find / -name 'libgsl.so.??' || printf '')" \
&& if [ -n "$gsl_path" ]; then \
ln -sfv "$gsl_path" "$(dirname $gsl_path)/libgsl.so.0"; \
fi \
&& ldconfig \
&& mkdir -p /opt/afni-latest \
&& echo "Downloading AFNI ..." \
&& curl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
| tar -xz -C /opt/afni-latest --strip-components 1 \
&& yum install -y -q \
R-devel \
&& yum clean all \
&& rm -rf /var/cache/yum/* \
&& rPkgsInstall -pkgs ALL
# Save specification to JSON.
RUN printf '{ \
"pkg_manager": "yum", \
"existing_users": [ \
"root" \
], \
"instructions": [ \
{ \
"name": "from_", \
"kwds": { \
"base_image": "fedora:36" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"PATH": "/opt/afni-latest:$PATH", \
"AFNI_PLUGINPATH": "/opt/afni-latest" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "yum install -y -q \\\\\\n R \\\\\\n cmake \\\\\\n curl \\\\\\n ed \\\\\\n gsl \\\\\\n libGLU \\\\\\n libXp \\\\\\n libXpm \\\\\\n libcurl-devel \\\\\\n libgomp \\\\\\n libjpeg-turbo-devel \\\\\\n libpng12 \\\\\\n mesa-dri-drivers \\\\\\n mesa-dri-drivers \\\\\\n mesa-libGLw \\\\\\n ncurses-compat-libs \\\\\\n netpbm-progs \\\\\\n openmotif \\\\\\n openssl-devel \\\\\\n python-is-python3 \\\\\\n python3-pip \\\\\\n tcsh \\\\\\n udunits2-devel \\\\\\n unzip \\\\\\n wget \\\\\\n which \\\\\\n which \\\\\\n xorg-x11-fonts-misc \\\\\\n xorg-x11-server-Xvfb\\nyum clean all\\nrm -rf /var/cache/yum/*\\n\\ngsl_path=\\"$\(find / -name '"'"'libgsl.so.??'"'"' || printf '"'"''"'"'\)\\"\\nif [ -n \\"$gsl_path\\" ]; then \\\\\\n ln -sfv \\"$gsl_path\\" \\"$\(dirname $gsl_path\)/libgsl.so.0\\"; \\\\\\nfi\\nldconfig\\nmkdir -p /opt/afni-latest\\necho \\"Downloading AFNI ...\\"\\ncurl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \\\\\\n| tar -xz -C /opt/afni-latest --strip-components 1\\n yum install -y -q \\\\\\n R-devel\\nyum clean all\\nrm -rf /var/cache/yum/*\\n rPkgsInstall -pkgs ALL" \
} \
} \
] \
}' > /.reproenv.json
# End saving to specification to JSON.
Singularity# Generated by Neurodocker and Reproenv.
Bootstrap: docker
From: fedora:36
%environment
export PATH="/opt/afni-latest:$PATH"
export AFNI_PLUGINPATH="/opt/afni-latest"
%post
yum install -y -q \
R \
cmake \
curl \
ed \
gsl \
libGLU \
libXp \
libXpm \
libcurl-devel \
libgomp \
libjpeg-turbo-devel \
libpng12 \
mesa-dri-drivers \
mesa-dri-drivers \
mesa-libGLw \
ncurses-compat-libs \
netpbm-progs \
openmotif \
openssl-devel \
python-is-python3 \
python3-pip \
tcsh \
udunits2-devel \
unzip \
wget \
which \
which \
xorg-x11-fonts-misc \
xorg-x11-server-Xvfb
yum clean all
rm -rf /var/cache/yum/*
gsl_path="$(find / -name 'libgsl.so.??' || printf '')"
if [ -n "$gsl_path" ]; then \
ln -sfv "$gsl_path" "$(dirname $gsl_path)/libgsl.so.0"; \
fi
ldconfig
mkdir -p /opt/afni-latest
echo "Downloading AFNI ..."
curl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
| tar -xz -C /opt/afni-latest --strip-components 1
yum install -y -q \
R-devel
yum clean all
rm -rf /var/cache/yum/*
rPkgsInstall -pkgs ALL
# Save specification to JSON.
printf '{ \
"pkg_manager": "yum", \
"existing_users": [ \
"root" \
], \
"instructions": [ \
{ \
"name": "from_", \
"kwds": { \
"base_image": "fedora:36" \
} \
}, \
{ \
"name": "env", \
"kwds": { \
"PATH": "/opt/afni-latest:$PATH", \
"AFNI_PLUGINPATH": "/opt/afni-latest" \
} \
}, \
{ \
"name": "run", \
"kwds": { \
"command": "yum install -y -q \\\\\\n R \\\\\\n cmake \\\\\\n curl \\\\\\n ed \\\\\\n gsl \\\\\\n libGLU \\\\\\n libXp \\\\\\n libXpm \\\\\\n libcurl-devel \\\\\\n libgomp \\\\\\n libjpeg-turbo-devel \\\\\\n libpng12 \\\\\\n mesa-dri-drivers \\\\\\n mesa-dri-drivers \\\\\\n mesa-libGLw \\\\\\n ncurses-compat-libs \\\\\\n netpbm-progs \\\\\\n openmotif \\\\\\n openssl-devel \\\\\\n python-is-python3 \\\\\\n python3-pip \\\\\\n tcsh \\\\\\n udunits2-devel \\\\\\n unzip \\\\\\n wget \\\\\\n which \\\\\\n which \\\\\\n xorg-x11-fonts-misc \\\\\\n xorg-x11-server-Xvfb\\nyum clean all\\nrm -rf /var/cache/yum/*\\n\\ngsl_path=\\"$\(find / -name '"'"'libgsl.so.??'"'"' || printf '"'"''"'"'\)\\"\\nif [ -n \\"$gsl_path\\" ]; then \\\\\\n ln -sfv \\"$gsl_path\\" \\"$\(dirname $gsl_path\)/libgsl.so.0\\"; \\\\\\nfi\\nldconfig\\nmkdir -p /opt/afni-latest\\necho \\"Downloading AFNI ...\\"\\ncurl -fL https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \\\\\\n| tar -xz -C /opt/afni-latest --strip-components 1\\n yum install -y -q \\\\\\n R-devel\\nyum clean all\\nrm -rf /var/cache/yum/*\\n rPkgsInstall -pkgs ALL" \
} \
} \
] \
}' > /.reproenv.json
# End saving to specification to JSON. |
indeed, singularity does not make related:
i think the solution would be to add @stebo85 - what do you think? if apptainer / singularity developers are reading, then i would like to say that i find this behavior highly unexpected. |
Dear @kaczmarj - great find - that explains the problems. I tried adding
I know it's not elegant, but would anything else speak against re-exporting the environment variables in the post section?
at least it works :?
@vsoch - could you maybe have quick look at what we are getting wrong here? Kind regards |
fine with me if there's no better solution. |
This is a left-over from issue #584, but I opened a new issue to keep it focussed on the actual problem.
Building afni with singularity currently doesn't work (but works with docker):
This results in:
@kaczmarj, Is there a difference in how Singularity files are written in Neurodocker as compared to how docker files are written that would explain why a tool is not on the path in Singularity, but is on Path when building in Docker?
Thank you
Steffen
The text was updated successfully, but these errors were encountered: