From bf1ff4918fa8e5ce19e6df8822b2dd834fdcaa52 Mon Sep 17 00:00:00 2001 From: VRShard Date: Tue, 24 Jan 2023 22:54:22 +0000 Subject: [PATCH] Fix Dockerfile conda install error for some shells (#92702) The issue was first solved in [/pull/91371] for CI/CD, but the main Dockerfile in the repo root still has this issue for people trying to test build custom image manually. Without it the build fails at installing miniconda ``` #14 3.802 Preparing transaction: ...working... done #14 4.087 Executing transaction: ...working... done #14 5.713 /root/miniconda.sh: 438: /root/miniconda.sh: [[: not found #14 5.713 #14 5.713 Installing * environment... #14 5.713 #14 5.714 /root/miniconda.sh: 444: /root/miniconda.sh: [[: not found #14 6.050 #14 6.050 CondaFileIOError: '/opt/conda/pkgs/envs/*/env.txt'. [Errno 2] No such file or directory: '/opt/conda/pkgs/envs/*/env.txt' #14 6.050 ``` With the modification, locally tested build successfully with `make -f ./docker.Makefile` as instructed in the README Pull Request resolved: https://github.com/pytorch/pytorch/pull/92702 Approved by: https://github.com/seemethere, https://github.com/malfet --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 36e6a57bc95cd..ce420dcb383aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,8 +36,9 @@ RUN case ${TARGETPLATFORM} in \ esac && \ curl -fsSL -v -o ~/miniconda.sh -O "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${MINICONDA_ARCH}.sh" COPY requirements.txt . +# Manually invoke bash on miniconda script per https://github.com/conda/conda/issues/10431 RUN chmod +x ~/miniconda.sh && \ - ~/miniconda.sh -b -p /opt/conda && \ + bash ~/miniconda.sh -b -p /opt/conda && \ rm ~/miniconda.sh && \ /opt/conda/bin/conda install -y python=${PYTHON_VERSION} cmake conda-build pyyaml numpy ipython && \ /opt/conda/bin/python -mpip install -r requirements.txt && \