I have tried the script from the author, and it failed with this output:
(pytorch) C:\Users\Yann\Desktop\git\pytorch>python setup.py build --cmake
Building wheel torch-1.7.0a0+ac1f471
– Building version 1.7.0a0+ac1f471
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja -DCMAKE_INSTALL_PREFIX=C:\Users\Yann\Desktop\git\pytorch\torch -DCMAKE_PREFIX_PATH=C:\Users\Yann\anaconda3\envs\pytorch\Lib\site-packages -DNUMPY_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Users\Yann\anaconda3\envs\pytorch\python.exe -DPYTHON_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\include -DPYTHON_LIBRARY=C:\Users\Yann\anaconda3\envs\pytorch/libs/python38.lib -DTORCH_BUILD_VERSION=1.7.0a0+ac1f471 -DUSE_NUMPY=True C:\Users\Yann\Desktop\git\pytorch
CMake Error at C:/Users/Yann/anaconda3/envs/pytorch/Library/share/cmake-3.17/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
Could not find compiler set in environment variable CXX:
cl.exe.
Call Stack (most recent call first):
CMakeLists.txt:23 (project)
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
– Configuring incomplete, errors occurred!
See also “C:/Users/Yann/Desktop/git/pytorch/build/CMakeFiles/CMakeOutput.log”.
See also “C:/Users/Yann/Desktop/git/pytorch/build/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “setup.py”, line 748, in
build_deps()
File “setup.py”, line 327, in build_deps
build_caffe2(version=version,
File “C:\Users\Yann\Desktop\git\pytorch\tools\build_pytorch_libs.py”, line 54, in build_caffe2
cmake.generate(version,
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 329, in generate
self.run(args, env=my_env)
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 141, in run
check_call(command, cwd=self.build_dir, env=env)
File “C:\Users\Yann\anaconda3\envs\pytorch\lib\subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘-GNinja’, ‘-DBUILD_PYTHON=True’, ‘-DBUILD_TEST=True’, ‘-DCMAKE_BUILD_TYPE=Release’, ‘-DCMAKE_GENERATOR=Ninja’, ‘-DCMAKE_INSTALL_PREFIX=C:\Users\Yann\Desktop\git\pytorch\torch’, ‘-DCMAKE_PREFIX_PATH=C:\Users\Yann\anaconda3\envs\pytorch\Lib\site-packages’, ‘-DNUMPY_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\lib\site-packages\numpy\core\include’, ‘-DPYTHON_EXECUTABLE=C:\Users\Yann\anaconda3\envs\pytorch\python.exe’, ‘-DPYTHON_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\include’, ‘-DPYTHON_LIBRARY=C:\Users\Yann\anaconda3\envs\pytorch/libs/python38.lib’, ‘-DTORCH_BUILD_VERSION=1.7.0a0+ac1f471’, ‘-DUSE_NUMPY=True’, ‘C:\Users\Yann\Desktop\git\pytorch’]’ returned non-zero exit status 1.
Then I tried to set CC and CXX manually to the absolute path of cl.exe, and it failed with the following output:
(pytorch) C:\Users\Yann\Desktop\git\pytorch>python setup.py build --cmake
Building wheel torch-1.7.0a0+ac1f471
– Building version 1.7.0a0+ac1f471
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja -DCMAKE_INSTALL_PREFIX=C:\Users\Yann\Desktop\git\pytorch\torch -DCMAKE_PREFIX_PATH=C:\Users\Yann\anaconda3\envs\pytorch\Lib\site-packages -DNUMPY_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Users\Yann\anaconda3\envs\pytorch\python.exe -DPYTHON_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\include -DPYTHON_LIBRARY=C:\Users\Yann\anaconda3\envs\pytorch/libs/python38.lib -DTORCH_BUILD_VERSION=1.7.0a0+ac1f471 -DUSE_NUMPY=True C:\Users\Yann\Desktop\git\pytorch
– The CXX compiler identification is MSVC 19.27.29111.0
– The C compiler identification is MSVC 19.27.29111.0
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Users/Yann/anaconda3/envs/pytorch/Library/share/cmake-3.17/Modules/CMakeTestCXXCompiler.cmake:53 (message):
The C++ compiler
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Yann/Desktop/git/pytorch/build/CMakeFiles/CMakeTmp
Run Build Command(s):C:/Users/Yann/anaconda3/envs/pytorch/Library/bin/ninja.exe cmTC_0a5a6 && [1/2] Building CXX object CMakeFiles\cmTC_0a5a6.dir\testCXXCompiler.cxx.obj
[2/2] Linking CXX executable cmTC_0a5a6.exe
FAILED: cmTC_0a5a6.exe
cmd.exe /C "cd . && C:\Users\Yann\anaconda3\envs\pytorch\Library\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_0a5a6.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~2\MICROS~3\2019\COMMUN~1\VC\Tools\MSVC\1427~1.291\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_0a5a6.dir\testCXXCompiler.cxx.obj /out:cmTC_0a5a6.exe /implib:cmTC_0a5a6.lib /pdb:cmTC_0a5a6.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
RC Pass 1: command "rc /fo CMakeFiles\cmTC_0a5a6.dir/manifest.res CMakeFiles\cmTC_0a5a6.dir/manifest.rc" failed (exit code 0) with the following output:
Le fichier spécifié est introuvable
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:23 (project)
– Configuring incomplete, errors occurred!
See also “C:/Users/Yann/Desktop/git/pytorch/build/CMakeFiles/CMakeOutput.log”.
See also “C:/Users/Yann/Desktop/git/pytorch/build/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “setup.py”, line 748, in
build_deps()
File “setup.py”, line 327, in build_deps
build_caffe2(version=version,
File “C:\Users\Yann\Desktop\git\pytorch\tools\build_pytorch_libs.py”, line 54, in build_caffe2
cmake.generate(version,
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 329, in generate
self.run(args, env=my_env)
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 141, in run
check_call(command, cwd=self.build_dir, env=env)
File “C:\Users\Yann\anaconda3\envs\pytorch\lib\subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘-GNinja’, ‘-DBUILD_PYTHON=True’, ‘-DBUILD_TEST=True’, ‘-DCMAKE_BUILD_TYPE=Release’, ‘-DCMAKE_GENERATOR=Ninja’, ‘-DCMAKE_INSTALL_PREFIX=C:\Users\Yann\Desktop\git\pytorch\torch’, ‘-DCMAKE_PREFIX_PATH=C:\Users\Yann\anaconda3\envs\pytorch\Lib\site-packages’, ‘-DNUMPY_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\lib\site-packages\numpy\core\include’, ‘-DPYTHON_EXECUTABLE=C:\Users\Yann\anaconda3\envs\pytorch\python.exe’, ‘-DPYTHON_INCLUDE_DIR=C:\Users\Yann\anaconda3\envs\pytorch\include’, ‘-DPYTHON_LIBRARY=C:\Users\Yann\anaconda3\envs\pytorch/libs/python38.lib’, ‘-DTORCH_BUILD_VERSION=1.7.0a0+ac1f471’, ‘-DUSE_NUMPY=True’, ‘C:\Users\Yann\Desktop\git\pytorch’]’ returned non-zero exit status 1.
EDIT:
Now I have tried to uninstall everything, install VS2017 with both the 14.11 and the 14.13 toolsets, installed CUDA 10.0 (successfully) and the corresponding cudnn, and have been retrying the script from the author. This time it starts compiling for a while, but at some point ninja fails with this kind of output:
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/internal/custom/gmock-generated-actions.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-generated-function-mockers.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-spec-builders.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-matchers.h
Remarque : inclusion du fichier : C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\math.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/internal/custom/gmock-matchers.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-generated-matchers.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-generated-nice-strict.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-more-actions.h
Remarque : inclusion du fichier : …\cmake..\third_party\googletest\googlemock\include\gmock/gmock-more-matchers.hninja: build stopped: subcommand failed.
Traceback (most recent call last):
File “setup.py”, line 748, in
build_deps()
File “setup.py”, line 327, in build_deps
build_caffe2(version=version,
File “C:\Users\Yann\Desktop\git\pytorch\tools\build_pytorch_libs.py”, line 62, in build_caffe2
cmake.build(my_env)
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 345, in build
self.run(build_args, my_env)
File “C:\Users\Yann\Desktop\git\pytorch\tools\setup_helpers\cmake.py”, line 141, in run
check_call(command, cwd=self.build_dir, env=env)
File “C:\Users\Yann\anaconda3\lib\subprocess.py”, line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–target’, ‘install’, ‘–config’, ‘Release’, ‘–’, ‘-j’, ‘8’]’ returned non-zero exit status 1.
Been trying with both -vcvars_ver=14.11 and -vcvars_ver=14.13, I had the same issue in both cases. I don’t know what else to try, help would be appreciated please.