Ninja error when building PyTorch from sources

Hello there!
I’ve tried to build PyTorch from sources. The following error occurs in the process:

ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 743, in <module>
    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.

Also i’ve tried this:

git clean -xdf
python setup.py clean
git submodule sync
git submodule deinit -f .
git submodule update --init --recursive

And it didn’t help. An error always occurs in the same place. There are no other errors in the logs.

At the same time a few months ago I’ve successfully assembled PyTorch with the current hardware and software configuration.

What could be the reason?

Hi,

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?

Do you mean the console output or something else logs?

Console outputs.
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 :smiley: )

That’s my outputs: https://gist.github.com/MrLebovsky/6592fe885910f79e5dd3e5e82d3340eb

Thanks !

Could that be an issue with VS v15.9.19 @peterjc123 ?

It was caused by an untested commit to master and it is now reverted.

1 Like

Does it mean that

python setup.py clean
git submodule update --init --recursive

will help?

python setup.py clean
git pull origin master
git submodule update --init --recursive

Thanks peter!

@MrLebovsky for future reference, note that you can also use the viable/strict branch in the main repo. It contains the latest master for which all the CI passed.

Unfortunately, it does not help. After pull with master I have the same error in different place.
I’ll try to use strict branch.

It helps to resolve my previously problem. But now, after changing the branch to strict , I have the following errors:
https://gist.github.com/MrLebovsky/bd0561c2fda1ef103d3921b809d8e17a

Is it looks like problem with CUDA version?

Here is the status of the CI builds. You may pick one that is all green for Windows.
https://ezyang.github.io/pytorch-ci-hud/build2/pytorch-master

@peterjc123 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?

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?
Thanks in advance!

Yeah. I mean that you pick a commit that goes through all the tests and then checkout that commit.
Example:

git clean -xdf
python setup.py clean
git checkout 3c409fc66c76ccbd10bd5d234c6ee8492ae7f653
git submodule sync
git submodule update --init --recursive

@albanD @peterjc123 It does not help :disappointed:
I’ve choouse the commit with all passed tests for windows: 3c409fc66c76ccbd10bd5d234c6ee8492ae7f653
Then I 've launched necessary git commands and the following output’s I have now:

What could be the reason?

Well, I just saw that you are trying to build with CUDA 9.0. I think it is not supported anymore. Only CUDA >= 9.2 builds are well tested now.

And how I can solve it?
My problem is too old hardware with GPU Nvidia GeForce 650M. That’s why I need to build torch from sources.

Can I take some of old commits and try againg or best way is install the CUDA 9.2?

I guess installing CUDA 9.2 is a good choice.