Ninja error when building PyTorch from sources

username: MrLebovsky
cooked: <p>Hello there!<br>
I’ve tried to build PyTorch from sources. The following error occurs in the process:</p>
<pre><code class="lang-auto">ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 743, in &lt;module&gt;
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "E:\PyTorch\pytorch\tools\build_pytorch_libs.py", line 62, in build_caffe2
    cmake.build(my_env)
  File "E:\PyTorch\pytorch\tools\setup_helpers\cmake.py", line 339, in build
    self.run(build_args, my_env)
  File "E:\PyTorch\pytorch\tools\setup_helpers\cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "C:\Users\Roman\Anaconda3\lib\subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '4']' returned non-zero exit status 1.
</code></pre>
<p>Also i’ve tried this:</p>
<pre><code class="lang-auto">git clean -xdf
python setup.py clean
git submodule sync
git submodule deinit -f .
git submodule update --init --recursive
</code></pre>
<p>And it didn’t help. An error always occurs in the same place. There are no other errors in the logs.</p>
<p>At the same time a few months ago I’ve successfully assembled PyTorch with the current hardware and software configuration.</p>
<p>What could be the reason?</p>

username: albanD
cooked: <p>Hi,</p>
<p>Unfortunately, the true error might be a bit far up in the log. Can you dump all the logs in a text file and share it here?</p>

username: MrLebovsky
cooked: <p>Do you mean the console output or something else logs?</p>

username: albanD
cooked: <p>Console outputs.<br>
Since the build runs in multithreaded way, few things can happen after the first error is detected (we are working on reducing the number of warnings <img src="https://discuss.pytorch.org/images/emoji/apple/smiley.png?v=9" title=":smiley:" class="emoji" alt=":smiley:"> )</p>

username: MrLebovsky
cooked: <p>That’s my outputs: <a href="https://gist.github.com/MrLebovsky/6592fe885910f79e5dd3e5e82d3340eb" rel="nofollow noopener">https://gist.github.com/MrLebovsky/6592fe885910f79e5dd3e5e82d3340eb</a></p>

username: albanD
cooked: <p>Thanks !</p>
<p>Could that be an issue with VS v15.9.19 <a class="mention" href="/u/peterjc123">@peterjc123</a> ?</p>

username: peterjc123
cooked: <p>It was caused by an untested commit to master and it is now reverted.</p>

username: MrLebovsky
cooked: <p>Does it mean that</p>
<pre><code class="lang-auto">python setup.py clean
git submodule update --init --recursive
</code></pre>
<p>will help?</p>

username: peterjc123
cooked: <pre><code class="lang-auto">python setup.py clean
git pull origin master
git submodule update --init --recursive
</code></pre>

username: albanD
cooked: <p>Thanks peter!</p>
<p><a class="mention" href="/u/mrlebovsky">@MrLebovsky</a> for future reference, note that you can also use the <code>viable/strict</code> branch in the main repo. It contains the latest master for which all the CI passed.</p>

username: MrLebovsky
cooked: <p>Unfortunately, it does not help. After pull with master I have the same error in different place.<br>
I’ll try to use <code>strict </code> branch.</p>

username: MrLebovsky
cooked: <p>It helps to resolve my previously problem. But now, after changing the branch to <code>strict </code>, I have the following errors:<br>
<a href="https://gist.github.com/MrLebovsky/bd0561c2fda1ef103d3921b809d8e17a" rel="nofollow noopener">https://gist.github.com/MrLebovsky/bd0561c2fda1ef103d3921b809d8e17a</a></p>
<p>Is it looks like problem with CUDA version?</p>

username: peterjc123
cooked: <p>Here is the status of the CI builds. You may pick one that is all green for Windows.<br>
<a href="https://ezyang.github.io/pytorch-ci-hud/build2/pytorch-master" class="onebox" target="_blank" rel="nofollow noopener">https://ezyang.github.io/pytorch-ci-hud/build2/pytorch-master</a></p>

username: MrLebovsky
cooked: <p><a class="mention" href="/u/peterjc123">@peterjc123</a> Building with my computer takes about a day. I’m afraid I didn’t quite understand you and will do something wrong. Could you describe the cause of the problem and its solution in more detail?</p>
<p>As far as I understand, I need to check-out to branch for which all the tests have passed and there will be no errors?<br>
Thanks in advance!</p>

username: peterjc123
cooked: <p>Yeah. I mean that you pick a commit that goes through all the tests and then checkout that commit.<br>
Example:</p>
<pre><code class="lang-auto">git clean -xdf
python setup.py clean
git checkout 3c409fc66c76ccbd10bd5d234c6ee8492ae7f653
git submodule sync
git submodule update --init --recursive
</code></pre>

username: MrLebovsky
cooked: <p><a class="mention" href="/u/alband">@albanD</a> <a class="mention" href="/u/peterjc123">@peterjc123</a>  It does not help <img src="https://discuss.pytorch.org/images/emoji/apple/disappointed.png?v=9" title=":disappointed:" class="emoji" alt=":disappointed:"><br>
I’ve choouse the commit with all passed tests for windows: 3c409fc66c76ccbd10bd5d234c6ee8492ae7f653<br>
Then I 've launched necessary git commands and the following output’s I have now:<br>
<aside class="onebox githubgist">
  <header class="source">
      <a href="https://gist.github.com/MrLebovsky/07e60b0ca113beabed9bf8c7ad7ca500" target="_blank" rel="nofollow noopener">gist.github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://gist.github.com/MrLebovsky/07e60b0ca113beabed9bf8c7ad7ca500" target="_blank" rel="nofollow noopener">https://gist.github.com/MrLebovsky/07e60b0ca113beabed9bf8c7ad7ca500</a></h4>
<h5>outputs.txt</h5>
<pre><code class="Text">[2212/3130] Linking CXX shared library bin\torch_cpu.dll
LINK : The 32-bit linker (C: \ PROGRA ~ 2 \ MICROS ~ 1 \ 2017 \ COMMUN ~ 1 \ VC \ Tools \ MSVC \ 1411 ~ 1.255 \ bin \ HostX86 \ x64 \ link.exe) does not have enough heap size; the build is restarted with the 64-bit linker (C: \ Program Files (x86) \ Microsoft Visual Studio \ 2017 \ Community \ VC \ Tools \ MSVC \ 11/14/25503 \ bin \ HostX64 \ x64 \ link.exe)
[2213/3130] Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/torch_cuda_generated_THCSleep.cu.obj
THCSleep.cu
THCSleep.cu
[2214/3130] Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/torch_cuda_generated_THCBlas.cu.obj
THCBlas.cu
THCBlas.cu
[2215/3130] Building NVCC (Device) object caffe2/CMakeFiles/torch_cuda.dir/__/aten/src/THC/torch_cuda_generated_THCReduceApplyUtils.cu.obj
THCReduceApplyUtils.cu</code></pre>
This file has been truncated. <a href="https://gist.github.com/MrLebovsky/07e60b0ca113beabed9bf8c7ad7ca500" target="_blank" rel="nofollow noopener">show original</a>

<p>
</p>

  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>
</p>
<p>What could be the reason?</p>

username: peterjc123
cooked: <p>Well, I just saw that you are trying to build with CUDA 9.0. I think it is not supported anymore. Only CUDA &gt;= 9.2 builds are well tested now.</p>

username: MrLebovsky
cooked: <p>And how I can solve it?<br>
My problem is too old hardware with GPU Nvidia GeForce 650M. That’s why I need to build torch from sources.</p>
<p>Can I take some of old commits and try againg or best way is install the CUDA 9.2?</p>

username: peterjc123
cooked: <p>I guess installing CUDA 9.2 is a good choice.</p>