I cloned the Pytorch repo and executed DOCKER_BUILDKIT=1 docker build -t pytorchtest .
Sadly, there were errors:
#26 31.35 See also "/opt/pytorch/build/CMakeFiles/CMakeOutput.log".
#26 31.35 See also "/opt/pytorch/build/CMakeFiles/CMakeError.log".
#26 31.40 Building wheel torch-1.13.0a0+gitd83ca9e
#26 31.40 -- Building version 1.13.0a0+gitd83ca9e
#26 31.40 cmake -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/pytorch/torch -DCMAKE_PREFIX_PATH=/opt/conda/lib/python3.8/site-packages;/opt/conda/bin/../ -DNUMPY_INCLUDE_DIR=/opt/conda/lib/python3.8/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/opt/conda/bin/python -DPYTHON_INCLUDE_DIR=/opt/conda/include/python3.8 -DPYTHON_LIBRARY=/opt/conda/lib/libpython3.8.so.1.0 -DTORCH_BUILD_VERSION=1.13.0a0+gitd83ca9e -DUSE_NUMPY=True /opt/pytorch
------
executor failed running [/bin/sh -c TORCH_CUDA_ARCH_LIST="3.5 5.2 6.0 6.1 7.0+PTX 8.0" TORCH_NVCC_FLAGS="-Xfatbin -compress-all" CMAKE_PREFIX_PATH="$(dirname $(which conda))/../" python setup.py install]: exit code: 1
Am I doing something wrong? I’d like to build it like that in order to have a proper dev container for making changes to .cpp files and rebuilding, etc. I’d like to avoid installing the dependencies directly on the host.
I’m assuming this log is written in the filesystem of the temporary container used to build the image, which means it’s long gone after it exits and I see this error, no?
I guess this Dockerfile is used to build (some) docker images, but don’t know if it needs an update or if env vars need to be overridden, but @seemethere might know who is contributing this this file.
Seems like the final issue was with the COPY --from=submodule-update /opt/pytorch /opt/pytorch instruction. Some .bzl files were not getting copied. More precisely they were not getting added to the Docker build context because of a .dockerignore file. I’ve added the following line to the end of the .dockerignore and now it works:
!*.bzl
As far as I understand, this is a bug. These files are committed to the repo, so they should get copied.